@ts-for-gir/cli 4.0.0-rc.4 → 4.0.0-rc.6
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/bin/ts-for-gir +2074 -371
- package/dist-templates/types-locally/package.json +1 -1
- package/dist-templates/types-npm/package.json +5 -5
- package/dist-templates/types-workspace/package.json +1 -1
- package/package.json +17 -17
- package/src/commands/run-generation-command.ts +6 -1
- package/src/config/config-loader.ts +50 -3
- package/src/config/defaults.ts +2 -0
- package/src/config/options.ts +23 -0
- package/src/module-loader.ts +46 -14
- package/src/types/command-args.ts +6 -0
package/bin/ts-for-gir
CHANGED
|
@@ -7268,7 +7268,7 @@ import { dirname, join } from "node:path";
|
|
|
7268
7268
|
import { fileURLToPath } from "node:url";
|
|
7269
7269
|
function getPackageVersion() {
|
|
7270
7270
|
if (true) {
|
|
7271
|
-
return "4.0.0-rc.
|
|
7271
|
+
return "4.0.0-rc.6";
|
|
7272
7272
|
}
|
|
7273
7273
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
7274
7274
|
const currentDir = dirname(currentModulePath);
|
|
@@ -8165,7 +8165,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8165
8165
|
var NEW_LINE_REG_EXP = /[\n\r]+/g;
|
|
8166
8166
|
function getPackageVersion2() {
|
|
8167
8167
|
if (true) {
|
|
8168
|
-
return "4.0.0-rc.
|
|
8168
|
+
return "4.0.0-rc.6";
|
|
8169
8169
|
}
|
|
8170
8170
|
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
8171
8171
|
const currentDir = dirname2(currentModulePath);
|
|
@@ -8197,7 +8197,7 @@ __export(parser_exports, {
|
|
|
8197
8197
|
parseGir: () => parseGir
|
|
8198
8198
|
});
|
|
8199
8199
|
|
|
8200
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
8200
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/util.js
|
|
8201
8201
|
var nameStartChar = ":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";
|
|
8202
8202
|
var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
8203
8203
|
var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
|
|
@@ -8238,7 +8238,7 @@ var DANGEROUS_PROPERTY_NAMES = [
|
|
|
8238
8238
|
];
|
|
8239
8239
|
var criticalProperties = ["__proto__", "constructor", "prototype"];
|
|
8240
8240
|
|
|
8241
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
8241
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/validator.js
|
|
8242
8242
|
var defaultOptions = {
|
|
8243
8243
|
allowBooleanAttributes: false,
|
|
8244
8244
|
//A tag can have attributes without any value
|
|
@@ -8544,7 +8544,1476 @@ function getPositionFromMatch(match) {
|
|
|
8544
8544
|
return match.startIndex + match[1].length;
|
|
8545
8545
|
}
|
|
8546
8546
|
|
|
8547
|
-
// ../../.yarn/cache
|
|
8547
|
+
// ../../.yarn/cache/@nodable-entities-npm-2.1.0-6eb9f06ac0-355c55e82a.zip/node_modules/@nodable/entities/src/entities.js
|
|
8548
|
+
var BASIC_LATIN = {
|
|
8549
|
+
amp: "&",
|
|
8550
|
+
AMP: "&",
|
|
8551
|
+
lt: "<",
|
|
8552
|
+
LT: "<",
|
|
8553
|
+
gt: ">",
|
|
8554
|
+
GT: ">",
|
|
8555
|
+
quot: '"',
|
|
8556
|
+
QUOT: '"',
|
|
8557
|
+
apos: "'",
|
|
8558
|
+
lsquo: "\u2018",
|
|
8559
|
+
rsquo: "\u2019",
|
|
8560
|
+
ldquo: "\u201C",
|
|
8561
|
+
rdquo: "\u201D",
|
|
8562
|
+
lsquor: "\u201A",
|
|
8563
|
+
rsquor: "\u2019",
|
|
8564
|
+
ldquor: "\u201E",
|
|
8565
|
+
bdquo: "\u201E",
|
|
8566
|
+
comma: ",",
|
|
8567
|
+
period: ".",
|
|
8568
|
+
colon: ":",
|
|
8569
|
+
semi: ";",
|
|
8570
|
+
excl: "!",
|
|
8571
|
+
quest: "?",
|
|
8572
|
+
num: "#",
|
|
8573
|
+
dollar: "$",
|
|
8574
|
+
percent: "%",
|
|
8575
|
+
amp: "&",
|
|
8576
|
+
ast: "*",
|
|
8577
|
+
commat: "@",
|
|
8578
|
+
lowbar: "_",
|
|
8579
|
+
verbar: "|",
|
|
8580
|
+
vert: "|",
|
|
8581
|
+
sol: "/",
|
|
8582
|
+
bsol: "\\",
|
|
8583
|
+
lbrace: "{",
|
|
8584
|
+
rbrace: "}",
|
|
8585
|
+
lbrack: "[",
|
|
8586
|
+
rbrack: "]",
|
|
8587
|
+
lpar: "(",
|
|
8588
|
+
rpar: ")",
|
|
8589
|
+
nbsp: "\xA0",
|
|
8590
|
+
iexcl: "\xA1",
|
|
8591
|
+
cent: "\xA2",
|
|
8592
|
+
pound: "\xA3",
|
|
8593
|
+
curren: "\xA4",
|
|
8594
|
+
yen: "\xA5",
|
|
8595
|
+
brvbar: "\xA6",
|
|
8596
|
+
sect: "\xA7",
|
|
8597
|
+
uml: "\xA8",
|
|
8598
|
+
copy: "\xA9",
|
|
8599
|
+
COPY: "\xA9",
|
|
8600
|
+
ordf: "\xAA",
|
|
8601
|
+
laquo: "\xAB",
|
|
8602
|
+
not: "\xAC",
|
|
8603
|
+
shy: "\xAD",
|
|
8604
|
+
reg: "\xAE",
|
|
8605
|
+
REG: "\xAE",
|
|
8606
|
+
macr: "\xAF",
|
|
8607
|
+
deg: "\xB0",
|
|
8608
|
+
plusmn: "\xB1",
|
|
8609
|
+
sup2: "\xB2",
|
|
8610
|
+
sup3: "\xB3",
|
|
8611
|
+
acute: "\xB4",
|
|
8612
|
+
micro: "\xB5",
|
|
8613
|
+
para: "\xB6",
|
|
8614
|
+
middot: "\xB7",
|
|
8615
|
+
cedil: "\xB8",
|
|
8616
|
+
sup1: "\xB9",
|
|
8617
|
+
ordm: "\xBA",
|
|
8618
|
+
raquo: "\xBB",
|
|
8619
|
+
frac14: "\xBC",
|
|
8620
|
+
frac12: "\xBD",
|
|
8621
|
+
half: "\xBD",
|
|
8622
|
+
frac34: "\xBE",
|
|
8623
|
+
iquest: "\xBF",
|
|
8624
|
+
times: "\xD7",
|
|
8625
|
+
div: "\xF7",
|
|
8626
|
+
divide: "\xF7"
|
|
8627
|
+
};
|
|
8628
|
+
var LATIN_ACCENTS = {
|
|
8629
|
+
Agrave: "\xC0",
|
|
8630
|
+
agrave: "\xE0",
|
|
8631
|
+
Aacute: "\xC1",
|
|
8632
|
+
aacute: "\xE1",
|
|
8633
|
+
Acirc: "\xC2",
|
|
8634
|
+
acirc: "\xE2",
|
|
8635
|
+
Atilde: "\xC3",
|
|
8636
|
+
atilde: "\xE3",
|
|
8637
|
+
Auml: "\xC4",
|
|
8638
|
+
auml: "\xE4",
|
|
8639
|
+
Aring: "\xC5",
|
|
8640
|
+
aring: "\xE5",
|
|
8641
|
+
AElig: "\xC6",
|
|
8642
|
+
aelig: "\xE6",
|
|
8643
|
+
Ccedil: "\xC7",
|
|
8644
|
+
ccedil: "\xE7",
|
|
8645
|
+
Egrave: "\xC8",
|
|
8646
|
+
egrave: "\xE8",
|
|
8647
|
+
Eacute: "\xC9",
|
|
8648
|
+
eacute: "\xE9",
|
|
8649
|
+
Ecirc: "\xCA",
|
|
8650
|
+
ecirc: "\xEA",
|
|
8651
|
+
Euml: "\xCB",
|
|
8652
|
+
euml: "\xEB",
|
|
8653
|
+
Igrave: "\xCC",
|
|
8654
|
+
igrave: "\xEC",
|
|
8655
|
+
Iacute: "\xCD",
|
|
8656
|
+
iacute: "\xED",
|
|
8657
|
+
Icirc: "\xCE",
|
|
8658
|
+
icirc: "\xEE",
|
|
8659
|
+
Iuml: "\xCF",
|
|
8660
|
+
iuml: "\xEF",
|
|
8661
|
+
ETH: "\xD0",
|
|
8662
|
+
eth: "\xF0",
|
|
8663
|
+
Ntilde: "\xD1",
|
|
8664
|
+
ntilde: "\xF1",
|
|
8665
|
+
Ograve: "\xD2",
|
|
8666
|
+
ograve: "\xF2",
|
|
8667
|
+
Oacute: "\xD3",
|
|
8668
|
+
oacute: "\xF3",
|
|
8669
|
+
Ocirc: "\xD4",
|
|
8670
|
+
ocirc: "\xF4",
|
|
8671
|
+
Otilde: "\xD5",
|
|
8672
|
+
otilde: "\xF5",
|
|
8673
|
+
Ouml: "\xD6",
|
|
8674
|
+
ouml: "\xF6",
|
|
8675
|
+
Oslash: "\xD8",
|
|
8676
|
+
oslash: "\xF8",
|
|
8677
|
+
Ugrave: "\xD9",
|
|
8678
|
+
ugrave: "\xF9",
|
|
8679
|
+
Uacute: "\xDA",
|
|
8680
|
+
uacute: "\xFA",
|
|
8681
|
+
Ucirc: "\xDB",
|
|
8682
|
+
ucirc: "\xFB",
|
|
8683
|
+
Uuml: "\xDC",
|
|
8684
|
+
uuml: "\xFC",
|
|
8685
|
+
Yacute: "\xDD",
|
|
8686
|
+
yacute: "\xFD",
|
|
8687
|
+
THORN: "\xDE",
|
|
8688
|
+
thorn: "\xFE",
|
|
8689
|
+
szlig: "\xDF",
|
|
8690
|
+
yuml: "\xFF",
|
|
8691
|
+
Yuml: "\u0178"
|
|
8692
|
+
};
|
|
8693
|
+
var LATIN_EXTENDED = {
|
|
8694
|
+
Amacr: "\u0100",
|
|
8695
|
+
amacr: "\u0101",
|
|
8696
|
+
Abreve: "\u0102",
|
|
8697
|
+
abreve: "\u0103",
|
|
8698
|
+
Aogon: "\u0104",
|
|
8699
|
+
aogon: "\u0105",
|
|
8700
|
+
Cacute: "\u0106",
|
|
8701
|
+
cacute: "\u0107",
|
|
8702
|
+
Ccirc: "\u0108",
|
|
8703
|
+
ccirc: "\u0109",
|
|
8704
|
+
Cdot: "\u010A",
|
|
8705
|
+
cdot: "\u010B",
|
|
8706
|
+
Ccaron: "\u010C",
|
|
8707
|
+
ccaron: "\u010D",
|
|
8708
|
+
Dcaron: "\u010E",
|
|
8709
|
+
dcaron: "\u010F",
|
|
8710
|
+
Dstrok: "\u0110",
|
|
8711
|
+
dstrok: "\u0111",
|
|
8712
|
+
Emacr: "\u0112",
|
|
8713
|
+
emacr: "\u0113",
|
|
8714
|
+
Ecaron: "\u011A",
|
|
8715
|
+
ecaron: "\u011B",
|
|
8716
|
+
Edot: "\u0116",
|
|
8717
|
+
edot: "\u0117",
|
|
8718
|
+
Eogon: "\u0118",
|
|
8719
|
+
eogon: "\u0119",
|
|
8720
|
+
Gcirc: "\u011C",
|
|
8721
|
+
gcirc: "\u011D",
|
|
8722
|
+
Gbreve: "\u011E",
|
|
8723
|
+
gbreve: "\u011F",
|
|
8724
|
+
Gdot: "\u0120",
|
|
8725
|
+
gdot: "\u0121",
|
|
8726
|
+
Gcedil: "\u0122",
|
|
8727
|
+
Hcirc: "\u0124",
|
|
8728
|
+
hcirc: "\u0125",
|
|
8729
|
+
Hstrok: "\u0126",
|
|
8730
|
+
hstrok: "\u0127",
|
|
8731
|
+
Itilde: "\u0128",
|
|
8732
|
+
itilde: "\u0129",
|
|
8733
|
+
Imacr: "\u012A",
|
|
8734
|
+
imacr: "\u012B",
|
|
8735
|
+
Iogon: "\u012E",
|
|
8736
|
+
iogon: "\u012F",
|
|
8737
|
+
Idot: "\u0130",
|
|
8738
|
+
IJlig: "\u0132",
|
|
8739
|
+
ijlig: "\u0133",
|
|
8740
|
+
Jcirc: "\u0134",
|
|
8741
|
+
jcirc: "\u0135",
|
|
8742
|
+
Kcedil: "\u0136",
|
|
8743
|
+
kcedil: "\u0137",
|
|
8744
|
+
kgreen: "\u0138",
|
|
8745
|
+
Lacute: "\u0139",
|
|
8746
|
+
lacute: "\u013A",
|
|
8747
|
+
Lcedil: "\u013B",
|
|
8748
|
+
lcedil: "\u013C",
|
|
8749
|
+
Lcaron: "\u013D",
|
|
8750
|
+
lcaron: "\u013E",
|
|
8751
|
+
Lmidot: "\u013F",
|
|
8752
|
+
lmidot: "\u0140",
|
|
8753
|
+
Lstrok: "\u0141",
|
|
8754
|
+
lstrok: "\u0142",
|
|
8755
|
+
Nacute: "\u0143",
|
|
8756
|
+
nacute: "\u0144",
|
|
8757
|
+
Ncaron: "\u0147",
|
|
8758
|
+
ncaron: "\u0148",
|
|
8759
|
+
Ncedil: "\u0145",
|
|
8760
|
+
ncedil: "\u0146",
|
|
8761
|
+
ENG: "\u014A",
|
|
8762
|
+
eng: "\u014B",
|
|
8763
|
+
Omacr: "\u014C",
|
|
8764
|
+
omacr: "\u014D",
|
|
8765
|
+
Odblac: "\u0150",
|
|
8766
|
+
odblac: "\u0151",
|
|
8767
|
+
OElig: "\u0152",
|
|
8768
|
+
oelig: "\u0153",
|
|
8769
|
+
Racute: "\u0154",
|
|
8770
|
+
racute: "\u0155",
|
|
8771
|
+
Rcaron: "\u0158",
|
|
8772
|
+
rcaron: "\u0159",
|
|
8773
|
+
Rcedil: "\u0156",
|
|
8774
|
+
rcedil: "\u0157",
|
|
8775
|
+
Sacute: "\u015A",
|
|
8776
|
+
sacute: "\u015B",
|
|
8777
|
+
Scirc: "\u015C",
|
|
8778
|
+
scirc: "\u015D",
|
|
8779
|
+
Scedil: "\u015E",
|
|
8780
|
+
scedil: "\u015F",
|
|
8781
|
+
Scaron: "\u0160",
|
|
8782
|
+
scaron: "\u0161",
|
|
8783
|
+
Tcedil: "\u0162",
|
|
8784
|
+
tcedil: "\u0163",
|
|
8785
|
+
Tcaron: "\u0164",
|
|
8786
|
+
tcaron: "\u0165",
|
|
8787
|
+
Tstrok: "\u0166",
|
|
8788
|
+
tstrok: "\u0167",
|
|
8789
|
+
Utilde: "\u0168",
|
|
8790
|
+
utilde: "\u0169",
|
|
8791
|
+
Umacr: "\u016A",
|
|
8792
|
+
umacr: "\u016B",
|
|
8793
|
+
Ubreve: "\u016C",
|
|
8794
|
+
ubreve: "\u016D",
|
|
8795
|
+
Uring: "\u016E",
|
|
8796
|
+
uring: "\u016F",
|
|
8797
|
+
Udblac: "\u0170",
|
|
8798
|
+
udblac: "\u0171",
|
|
8799
|
+
Uogon: "\u0172",
|
|
8800
|
+
uogon: "\u0173",
|
|
8801
|
+
Wcirc: "\u0174",
|
|
8802
|
+
wcirc: "\u0175",
|
|
8803
|
+
Ycirc: "\u0176",
|
|
8804
|
+
ycirc: "\u0177",
|
|
8805
|
+
Zacute: "\u0179",
|
|
8806
|
+
zacute: "\u017A",
|
|
8807
|
+
Zdot: "\u017B",
|
|
8808
|
+
zdot: "\u017C",
|
|
8809
|
+
Zcaron: "\u017D",
|
|
8810
|
+
zcaron: "\u017E"
|
|
8811
|
+
};
|
|
8812
|
+
var GREEK = {
|
|
8813
|
+
Alpha: "\u0391",
|
|
8814
|
+
alpha: "\u03B1",
|
|
8815
|
+
Beta: "\u0392",
|
|
8816
|
+
beta: "\u03B2",
|
|
8817
|
+
Gamma: "\u0393",
|
|
8818
|
+
gamma: "\u03B3",
|
|
8819
|
+
Delta: "\u0394",
|
|
8820
|
+
delta: "\u03B4",
|
|
8821
|
+
Epsilon: "\u0395",
|
|
8822
|
+
epsilon: "\u03B5",
|
|
8823
|
+
epsiv: "\u03F5",
|
|
8824
|
+
varepsilon: "\u03F5",
|
|
8825
|
+
Zeta: "\u0396",
|
|
8826
|
+
zeta: "\u03B6",
|
|
8827
|
+
Eta: "\u0397",
|
|
8828
|
+
eta: "\u03B7",
|
|
8829
|
+
Theta: "\u0398",
|
|
8830
|
+
theta: "\u03B8",
|
|
8831
|
+
thetasym: "\u03D1",
|
|
8832
|
+
vartheta: "\u03D1",
|
|
8833
|
+
Iota: "\u0399",
|
|
8834
|
+
iota: "\u03B9",
|
|
8835
|
+
Kappa: "\u039A",
|
|
8836
|
+
kappa: "\u03BA",
|
|
8837
|
+
kappav: "\u03F0",
|
|
8838
|
+
varkappa: "\u03F0",
|
|
8839
|
+
Lambda: "\u039B",
|
|
8840
|
+
lambda: "\u03BB",
|
|
8841
|
+
Mu: "\u039C",
|
|
8842
|
+
mu: "\u03BC",
|
|
8843
|
+
Nu: "\u039D",
|
|
8844
|
+
nu: "\u03BD",
|
|
8845
|
+
Xi: "\u039E",
|
|
8846
|
+
xi: "\u03BE",
|
|
8847
|
+
Omicron: "\u039F",
|
|
8848
|
+
omicron: "\u03BF",
|
|
8849
|
+
Pi: "\u03A0",
|
|
8850
|
+
pi: "\u03C0",
|
|
8851
|
+
piv: "\u03D6",
|
|
8852
|
+
varpi: "\u03D6",
|
|
8853
|
+
Rho: "\u03A1",
|
|
8854
|
+
rho: "\u03C1",
|
|
8855
|
+
rhov: "\u03F1",
|
|
8856
|
+
varrho: "\u03F1",
|
|
8857
|
+
Sigma: "\u03A3",
|
|
8858
|
+
sigma: "\u03C3",
|
|
8859
|
+
sigmaf: "\u03C2",
|
|
8860
|
+
sigmav: "\u03C2",
|
|
8861
|
+
varsigma: "\u03C2",
|
|
8862
|
+
Tau: "\u03A4",
|
|
8863
|
+
tau: "\u03C4",
|
|
8864
|
+
Upsilon: "\u03A5",
|
|
8865
|
+
upsilon: "\u03C5",
|
|
8866
|
+
upsi: "\u03C5",
|
|
8867
|
+
Upsi: "\u03D2",
|
|
8868
|
+
upsih: "\u03D2",
|
|
8869
|
+
Phi: "\u03A6",
|
|
8870
|
+
phi: "\u03C6",
|
|
8871
|
+
phiv: "\u03D5",
|
|
8872
|
+
varphi: "\u03D5",
|
|
8873
|
+
Chi: "\u03A7",
|
|
8874
|
+
chi: "\u03C7",
|
|
8875
|
+
Psi: "\u03A8",
|
|
8876
|
+
psi: "\u03C8",
|
|
8877
|
+
Omega: "\u03A9",
|
|
8878
|
+
omega: "\u03C9",
|
|
8879
|
+
ohm: "\u03A9",
|
|
8880
|
+
Gammad: "\u03DC",
|
|
8881
|
+
gammad: "\u03DD",
|
|
8882
|
+
digamma: "\u03DD"
|
|
8883
|
+
};
|
|
8884
|
+
var CYRILLIC = {
|
|
8885
|
+
Afr: "\u{1D504}",
|
|
8886
|
+
afr: "\u{1D51E}",
|
|
8887
|
+
Acy: "\u0410",
|
|
8888
|
+
acy: "\u0430",
|
|
8889
|
+
Bcy: "\u0411",
|
|
8890
|
+
bcy: "\u0431",
|
|
8891
|
+
Vcy: "\u0412",
|
|
8892
|
+
vcy: "\u0432",
|
|
8893
|
+
Gcy: "\u0413",
|
|
8894
|
+
gcy: "\u0433",
|
|
8895
|
+
Dcy: "\u0414",
|
|
8896
|
+
dcy: "\u0434",
|
|
8897
|
+
IEcy: "\u0415",
|
|
8898
|
+
iecy: "\u0435",
|
|
8899
|
+
IOcy: "\u0401",
|
|
8900
|
+
iocy: "\u0451",
|
|
8901
|
+
ZHcy: "\u0416",
|
|
8902
|
+
zhcy: "\u0436",
|
|
8903
|
+
Zcy: "\u0417",
|
|
8904
|
+
zcy: "\u0437",
|
|
8905
|
+
Icy: "\u0418",
|
|
8906
|
+
icy: "\u0438",
|
|
8907
|
+
Jcy: "\u0419",
|
|
8908
|
+
jcy: "\u0439",
|
|
8909
|
+
Kcy: "\u041A",
|
|
8910
|
+
kcy: "\u043A",
|
|
8911
|
+
Lcy: "\u041B",
|
|
8912
|
+
lcy: "\u043B",
|
|
8913
|
+
Mcy: "\u041C",
|
|
8914
|
+
mcy: "\u043C",
|
|
8915
|
+
Ncy: "\u041D",
|
|
8916
|
+
ncy: "\u043D",
|
|
8917
|
+
Ocy: "\u041E",
|
|
8918
|
+
ocy: "\u043E",
|
|
8919
|
+
Pcy: "\u041F",
|
|
8920
|
+
pcy: "\u043F",
|
|
8921
|
+
Rcy: "\u0420",
|
|
8922
|
+
rcy: "\u0440",
|
|
8923
|
+
Scy: "\u0421",
|
|
8924
|
+
scy: "\u0441",
|
|
8925
|
+
Tcy: "\u0422",
|
|
8926
|
+
tcy: "\u0442",
|
|
8927
|
+
Ucy: "\u0423",
|
|
8928
|
+
ucy: "\u0443",
|
|
8929
|
+
Fcy: "\u0424",
|
|
8930
|
+
fcy: "\u0444",
|
|
8931
|
+
KHcy: "\u0425",
|
|
8932
|
+
khcy: "\u0445",
|
|
8933
|
+
TScy: "\u0426",
|
|
8934
|
+
tscy: "\u0446",
|
|
8935
|
+
CHcy: "\u0427",
|
|
8936
|
+
chcy: "\u0447",
|
|
8937
|
+
SHcy: "\u0428",
|
|
8938
|
+
shcy: "\u0448",
|
|
8939
|
+
SHCHcy: "\u0429",
|
|
8940
|
+
shchcy: "\u0449",
|
|
8941
|
+
HARDcy: "\u042A",
|
|
8942
|
+
hardcy: "\u044A",
|
|
8943
|
+
Ycy: "\u042B",
|
|
8944
|
+
ycy: "\u044B",
|
|
8945
|
+
SOFTcy: "\u042C",
|
|
8946
|
+
softcy: "\u044C",
|
|
8947
|
+
Ecy: "\u042D",
|
|
8948
|
+
ecy: "\u044D",
|
|
8949
|
+
YUcy: "\u042E",
|
|
8950
|
+
yucy: "\u044E",
|
|
8951
|
+
YAcy: "\u042F",
|
|
8952
|
+
yacy: "\u044F",
|
|
8953
|
+
DJcy: "\u0402",
|
|
8954
|
+
djcy: "\u0452",
|
|
8955
|
+
GJcy: "\u0403",
|
|
8956
|
+
gjcy: "\u0453",
|
|
8957
|
+
Jukcy: "\u0404",
|
|
8958
|
+
jukcy: "\u0454",
|
|
8959
|
+
DScy: "\u0405",
|
|
8960
|
+
dscy: "\u0455",
|
|
8961
|
+
Iukcy: "\u0406",
|
|
8962
|
+
iukcy: "\u0456",
|
|
8963
|
+
YIcy: "\u0407",
|
|
8964
|
+
yicy: "\u0457",
|
|
8965
|
+
Jsercy: "\u0408",
|
|
8966
|
+
jsercy: "\u0458",
|
|
8967
|
+
LJcy: "\u0409",
|
|
8968
|
+
ljcy: "\u0459",
|
|
8969
|
+
NJcy: "\u040A",
|
|
8970
|
+
njcy: "\u045A",
|
|
8971
|
+
TSHcy: "\u040B",
|
|
8972
|
+
tshcy: "\u045B",
|
|
8973
|
+
KJcy: "\u040C",
|
|
8974
|
+
kjcy: "\u045C",
|
|
8975
|
+
Ubrcy: "\u040E",
|
|
8976
|
+
ubrcy: "\u045E",
|
|
8977
|
+
DZcy: "\u040F",
|
|
8978
|
+
dzcy: "\u045F"
|
|
8979
|
+
};
|
|
8980
|
+
var MATH = {
|
|
8981
|
+
plus: "+",
|
|
8982
|
+
minus: "\u2212",
|
|
8983
|
+
mnplus: "\u2213",
|
|
8984
|
+
mp: "\u2213",
|
|
8985
|
+
pm: "\xB1",
|
|
8986
|
+
times: "\xD7",
|
|
8987
|
+
div: "\xF7",
|
|
8988
|
+
divide: "\xF7",
|
|
8989
|
+
sdot: "\u22C5",
|
|
8990
|
+
star: "\u2606",
|
|
8991
|
+
starf: "\u2605",
|
|
8992
|
+
bigstar: "\u2605",
|
|
8993
|
+
lowast: "\u2217",
|
|
8994
|
+
ast: "*",
|
|
8995
|
+
midast: "*",
|
|
8996
|
+
compfn: "\u2218",
|
|
8997
|
+
smallcircle: "\u2218",
|
|
8998
|
+
bullet: "\u2022",
|
|
8999
|
+
bull: "\u2022",
|
|
9000
|
+
nbsp: "\xA0",
|
|
9001
|
+
hellip: "\u2026",
|
|
9002
|
+
mldr: "\u2026",
|
|
9003
|
+
prime: "\u2032",
|
|
9004
|
+
Prime: "\u2033",
|
|
9005
|
+
tprime: "\u2034",
|
|
9006
|
+
bprime: "\u2035",
|
|
9007
|
+
backprime: "\u2035",
|
|
9008
|
+
minus: "\u2212",
|
|
9009
|
+
minusd: "\u2238",
|
|
9010
|
+
dotminus: "\u2238",
|
|
9011
|
+
plusdo: "\u2214",
|
|
9012
|
+
dotplus: "\u2214",
|
|
9013
|
+
plusmn: "\xB1",
|
|
9014
|
+
minusplus: "\u2213",
|
|
9015
|
+
mnplus: "\u2213",
|
|
9016
|
+
mp: "\u2213",
|
|
9017
|
+
setminus: "\u2216",
|
|
9018
|
+
smallsetminus: "\u2216",
|
|
9019
|
+
Backslash: "\u2216",
|
|
9020
|
+
setmn: "\u2216",
|
|
9021
|
+
ssetmn: "\u2216",
|
|
9022
|
+
lowbar: "_",
|
|
9023
|
+
verbar: "|",
|
|
9024
|
+
vert: "|",
|
|
9025
|
+
VerticalLine: "|",
|
|
9026
|
+
colon: ":",
|
|
9027
|
+
Colon: "\u2237",
|
|
9028
|
+
Proportion: "\u2237",
|
|
9029
|
+
ratio: "\u2236",
|
|
9030
|
+
equals: "=",
|
|
9031
|
+
ne: "\u2260",
|
|
9032
|
+
nequiv: "\u2262",
|
|
9033
|
+
equiv: "\u2261",
|
|
9034
|
+
Congruent: "\u2261",
|
|
9035
|
+
sim: "\u223C",
|
|
9036
|
+
thicksim: "\u223C",
|
|
9037
|
+
thksim: "\u223C",
|
|
9038
|
+
sime: "\u2243",
|
|
9039
|
+
simeq: "\u2243",
|
|
9040
|
+
TildeEqual: "\u2243",
|
|
9041
|
+
asymp: "\u2248",
|
|
9042
|
+
approx: "\u2248",
|
|
9043
|
+
thickapprox: "\u2248",
|
|
9044
|
+
thkap: "\u2248",
|
|
9045
|
+
TildeTilde: "\u2248",
|
|
9046
|
+
ncong: "\u2247",
|
|
9047
|
+
cong: "\u2245",
|
|
9048
|
+
TildeFullEqual: "\u2245",
|
|
9049
|
+
asympeq: "\u224D",
|
|
9050
|
+
CupCap: "\u224D",
|
|
9051
|
+
bump: "\u224E",
|
|
9052
|
+
Bumpeq: "\u224E",
|
|
9053
|
+
HumpDownHump: "\u224E",
|
|
9054
|
+
bumpe: "\u224F",
|
|
9055
|
+
bumpeq: "\u224F",
|
|
9056
|
+
HumpEqual: "\u224F",
|
|
9057
|
+
dotminus: "\u2238",
|
|
9058
|
+
minusd: "\u2238",
|
|
9059
|
+
plusdo: "\u2214",
|
|
9060
|
+
dotplus: "\u2214",
|
|
9061
|
+
le: "\u2264",
|
|
9062
|
+
LessEqual: "\u2264",
|
|
9063
|
+
ge: "\u2265",
|
|
9064
|
+
GreaterEqual: "\u2265",
|
|
9065
|
+
lesseqgtr: "\u22DA",
|
|
9066
|
+
lesseqqgtr: "\u2A8B",
|
|
9067
|
+
greater: ">",
|
|
9068
|
+
less: "<"
|
|
9069
|
+
};
|
|
9070
|
+
var MATH_ADVANCED = {
|
|
9071
|
+
alefsym: "\u2135",
|
|
9072
|
+
aleph: "\u2135",
|
|
9073
|
+
beth: "\u2136",
|
|
9074
|
+
gimel: "\u2137",
|
|
9075
|
+
daleth: "\u2138",
|
|
9076
|
+
forall: "\u2200",
|
|
9077
|
+
ForAll: "\u2200",
|
|
9078
|
+
part: "\u2202",
|
|
9079
|
+
PartialD: "\u2202",
|
|
9080
|
+
exist: "\u2203",
|
|
9081
|
+
Exists: "\u2203",
|
|
9082
|
+
nexist: "\u2204",
|
|
9083
|
+
nexists: "\u2204",
|
|
9084
|
+
empty: "\u2205",
|
|
9085
|
+
emptyset: "\u2205",
|
|
9086
|
+
emptyv: "\u2205",
|
|
9087
|
+
varnothing: "\u2205",
|
|
9088
|
+
nabla: "\u2207",
|
|
9089
|
+
Del: "\u2207",
|
|
9090
|
+
isin: "\u2208",
|
|
9091
|
+
isinv: "\u2208",
|
|
9092
|
+
in: "\u2208",
|
|
9093
|
+
Element: "\u2208",
|
|
9094
|
+
notin: "\u2209",
|
|
9095
|
+
notinva: "\u2209",
|
|
9096
|
+
ni: "\u220B",
|
|
9097
|
+
niv: "\u220B",
|
|
9098
|
+
SuchThat: "\u220B",
|
|
9099
|
+
ReverseElement: "\u220B",
|
|
9100
|
+
notni: "\u220C",
|
|
9101
|
+
notniva: "\u220C",
|
|
9102
|
+
prod: "\u220F",
|
|
9103
|
+
Product: "\u220F",
|
|
9104
|
+
coprod: "\u2210",
|
|
9105
|
+
Coproduct: "\u2210",
|
|
9106
|
+
sum: "\u2211",
|
|
9107
|
+
Sum: "\u2211",
|
|
9108
|
+
minus: "\u2212",
|
|
9109
|
+
mp: "\u2213",
|
|
9110
|
+
plusdo: "\u2214",
|
|
9111
|
+
dotplus: "\u2214",
|
|
9112
|
+
setminus: "\u2216",
|
|
9113
|
+
lowast: "\u2217",
|
|
9114
|
+
radic: "\u221A",
|
|
9115
|
+
Sqrt: "\u221A",
|
|
9116
|
+
prop: "\u221D",
|
|
9117
|
+
propto: "\u221D",
|
|
9118
|
+
Proportional: "\u221D",
|
|
9119
|
+
varpropto: "\u221D",
|
|
9120
|
+
infin: "\u221E",
|
|
9121
|
+
infintie: "\u29DD",
|
|
9122
|
+
ang: "\u2220",
|
|
9123
|
+
angle: "\u2220",
|
|
9124
|
+
angmsd: "\u2221",
|
|
9125
|
+
measuredangle: "\u2221",
|
|
9126
|
+
angsph: "\u2222",
|
|
9127
|
+
mid: "\u2223",
|
|
9128
|
+
VerticalBar: "\u2223",
|
|
9129
|
+
nmid: "\u2224",
|
|
9130
|
+
nsmid: "\u2224",
|
|
9131
|
+
npar: "\u2226",
|
|
9132
|
+
parallel: "\u2225",
|
|
9133
|
+
spar: "\u2225",
|
|
9134
|
+
nparallel: "\u2226",
|
|
9135
|
+
nspar: "\u2226",
|
|
9136
|
+
and: "\u2227",
|
|
9137
|
+
wedge: "\u2227",
|
|
9138
|
+
or: "\u2228",
|
|
9139
|
+
vee: "\u2228",
|
|
9140
|
+
cap: "\u2229",
|
|
9141
|
+
cup: "\u222A",
|
|
9142
|
+
int: "\u222B",
|
|
9143
|
+
Integral: "\u222B",
|
|
9144
|
+
conint: "\u222E",
|
|
9145
|
+
ContourIntegral: "\u222E",
|
|
9146
|
+
Conint: "\u222F",
|
|
9147
|
+
DoubleContourIntegral: "\u222F",
|
|
9148
|
+
Cconint: "\u2230",
|
|
9149
|
+
there4: "\u2234",
|
|
9150
|
+
therefore: "\u2234",
|
|
9151
|
+
Therefore: "\u2234",
|
|
9152
|
+
becaus: "\u2235",
|
|
9153
|
+
because: "\u2235",
|
|
9154
|
+
Because: "\u2235",
|
|
9155
|
+
ratio: "\u2236",
|
|
9156
|
+
Proportion: "\u2237",
|
|
9157
|
+
minusd: "\u2238",
|
|
9158
|
+
dotminus: "\u2238",
|
|
9159
|
+
mDDot: "\u223A",
|
|
9160
|
+
homtht: "\u223B",
|
|
9161
|
+
sim: "\u223C",
|
|
9162
|
+
bsimg: "\u223D",
|
|
9163
|
+
backsim: "\u223D",
|
|
9164
|
+
ac: "\u223E",
|
|
9165
|
+
mstpos: "\u223E",
|
|
9166
|
+
acd: "\u223F",
|
|
9167
|
+
VerticalTilde: "\u2240",
|
|
9168
|
+
wr: "\u2240",
|
|
9169
|
+
wreath: "\u2240",
|
|
9170
|
+
nsime: "\u2244",
|
|
9171
|
+
nsimeq: "\u2244",
|
|
9172
|
+
nsimeq: "\u2244",
|
|
9173
|
+
ncong: "\u2247",
|
|
9174
|
+
simne: "\u2246",
|
|
9175
|
+
ncongdot: "\u2A6D\u0338",
|
|
9176
|
+
ngsim: "\u2275",
|
|
9177
|
+
nsim: "\u2241",
|
|
9178
|
+
napprox: "\u2249",
|
|
9179
|
+
nap: "\u2249",
|
|
9180
|
+
ngeq: "\u2271",
|
|
9181
|
+
nge: "\u2271",
|
|
9182
|
+
nleq: "\u2270",
|
|
9183
|
+
nle: "\u2270",
|
|
9184
|
+
ngtr: "\u226F",
|
|
9185
|
+
ngt: "\u226F",
|
|
9186
|
+
nless: "\u226E",
|
|
9187
|
+
nlt: "\u226E",
|
|
9188
|
+
nprec: "\u2280",
|
|
9189
|
+
npr: "\u2280",
|
|
9190
|
+
nsucc: "\u2281",
|
|
9191
|
+
nsc: "\u2281"
|
|
9192
|
+
};
|
|
9193
|
+
var ARROWS = {
|
|
9194
|
+
larr: "\u2190",
|
|
9195
|
+
leftarrow: "\u2190",
|
|
9196
|
+
LeftArrow: "\u2190",
|
|
9197
|
+
uarr: "\u2191",
|
|
9198
|
+
uparrow: "\u2191",
|
|
9199
|
+
UpArrow: "\u2191",
|
|
9200
|
+
rarr: "\u2192",
|
|
9201
|
+
rightarrow: "\u2192",
|
|
9202
|
+
RightArrow: "\u2192",
|
|
9203
|
+
darr: "\u2193",
|
|
9204
|
+
downarrow: "\u2193",
|
|
9205
|
+
DownArrow: "\u2193",
|
|
9206
|
+
harr: "\u2194",
|
|
9207
|
+
leftrightarrow: "\u2194",
|
|
9208
|
+
LeftRightArrow: "\u2194",
|
|
9209
|
+
varr: "\u2195",
|
|
9210
|
+
updownarrow: "\u2195",
|
|
9211
|
+
UpDownArrow: "\u2195",
|
|
9212
|
+
nwarr: "\u2196",
|
|
9213
|
+
nwarrow: "\u2196",
|
|
9214
|
+
UpperLeftArrow: "\u2196",
|
|
9215
|
+
nearr: "\u2197",
|
|
9216
|
+
nearrow: "\u2197",
|
|
9217
|
+
UpperRightArrow: "\u2197",
|
|
9218
|
+
searr: "\u2198",
|
|
9219
|
+
searrow: "\u2198",
|
|
9220
|
+
LowerRightArrow: "\u2198",
|
|
9221
|
+
swarr: "\u2199",
|
|
9222
|
+
swarrow: "\u2199",
|
|
9223
|
+
LowerLeftArrow: "\u2199",
|
|
9224
|
+
lArr: "\u21D0",
|
|
9225
|
+
Leftarrow: "\u21D0",
|
|
9226
|
+
uArr: "\u21D1",
|
|
9227
|
+
Uparrow: "\u21D1",
|
|
9228
|
+
rArr: "\u21D2",
|
|
9229
|
+
Rightarrow: "\u21D2",
|
|
9230
|
+
dArr: "\u21D3",
|
|
9231
|
+
Downarrow: "\u21D3",
|
|
9232
|
+
hArr: "\u21D4",
|
|
9233
|
+
Leftrightarrow: "\u21D4",
|
|
9234
|
+
iff: "\u21D4",
|
|
9235
|
+
vArr: "\u21D5",
|
|
9236
|
+
Updownarrow: "\u21D5",
|
|
9237
|
+
lAarr: "\u21DA",
|
|
9238
|
+
Lleftarrow: "\u21DA",
|
|
9239
|
+
rAarr: "\u21DB",
|
|
9240
|
+
Rrightarrow: "\u21DB",
|
|
9241
|
+
lrarr: "\u21C6",
|
|
9242
|
+
leftrightarrows: "\u21C6",
|
|
9243
|
+
rlarr: "\u21C4",
|
|
9244
|
+
rightleftarrows: "\u21C4",
|
|
9245
|
+
lrhar: "\u21CB",
|
|
9246
|
+
leftrightharpoons: "\u21CB",
|
|
9247
|
+
ReverseEquilibrium: "\u21CB",
|
|
9248
|
+
rlhar: "\u21CC",
|
|
9249
|
+
rightleftharpoons: "\u21CC",
|
|
9250
|
+
Equilibrium: "\u21CC",
|
|
9251
|
+
udarr: "\u21C5",
|
|
9252
|
+
UpArrowDownArrow: "\u21C5",
|
|
9253
|
+
duarr: "\u21F5",
|
|
9254
|
+
DownArrowUpArrow: "\u21F5",
|
|
9255
|
+
llarr: "\u21C7",
|
|
9256
|
+
leftleftarrows: "\u21C7",
|
|
9257
|
+
rrarr: "\u21C9",
|
|
9258
|
+
rightrightarrows: "\u21C9",
|
|
9259
|
+
ddarr: "\u21CA",
|
|
9260
|
+
downdownarrows: "\u21CA",
|
|
9261
|
+
har: "\u21BD",
|
|
9262
|
+
lhard: "\u21BD",
|
|
9263
|
+
leftharpoondown: "\u21BD",
|
|
9264
|
+
lharu: "\u21BC",
|
|
9265
|
+
leftharpoonup: "\u21BC",
|
|
9266
|
+
rhard: "\u21C1",
|
|
9267
|
+
rightharpoondown: "\u21C1",
|
|
9268
|
+
rharu: "\u21C0",
|
|
9269
|
+
rightharpoonup: "\u21C0",
|
|
9270
|
+
lsh: "\u21B0",
|
|
9271
|
+
Lsh: "\u21B0",
|
|
9272
|
+
rsh: "\u21B1",
|
|
9273
|
+
Rsh: "\u21B1",
|
|
9274
|
+
ldsh: "\u21B2",
|
|
9275
|
+
rdsh: "\u21B3",
|
|
9276
|
+
hookleftarrow: "\u21A9",
|
|
9277
|
+
hookrightarrow: "\u21AA",
|
|
9278
|
+
mapstoleft: "\u21A4",
|
|
9279
|
+
mapstoup: "\u21A5",
|
|
9280
|
+
map: "\u21A6",
|
|
9281
|
+
mapsto: "\u21A6",
|
|
9282
|
+
mapstodown: "\u21A7",
|
|
9283
|
+
crarr: "\u21B5",
|
|
9284
|
+
nwarrow: "\u2196",
|
|
9285
|
+
nearrow: "\u2197",
|
|
9286
|
+
searrow: "\u2198",
|
|
9287
|
+
swarrow: "\u2199",
|
|
9288
|
+
nleftarrow: "\u219A",
|
|
9289
|
+
nleftrightarrow: "\u21AE",
|
|
9290
|
+
nrightarrow: "\u219B",
|
|
9291
|
+
nrarr: "\u219B",
|
|
9292
|
+
larrtl: "\u21A2",
|
|
9293
|
+
rarrtl: "\u21A3",
|
|
9294
|
+
leftarrowtail: "\u21A2",
|
|
9295
|
+
rightarrowtail: "\u21A3",
|
|
9296
|
+
twoheadleftarrow: "\u219E",
|
|
9297
|
+
twoheadrightarrow: "\u21A0",
|
|
9298
|
+
Larr: "\u219E",
|
|
9299
|
+
Rarr: "\u21A0",
|
|
9300
|
+
larrhk: "\u21A9",
|
|
9301
|
+
rarrhk: "\u21AA",
|
|
9302
|
+
larrlp: "\u21AB",
|
|
9303
|
+
looparrowleft: "\u21AB",
|
|
9304
|
+
rarrlp: "\u21AC",
|
|
9305
|
+
looparrowright: "\u21AC",
|
|
9306
|
+
harrw: "\u21AD",
|
|
9307
|
+
leftrightsquigarrow: "\u21AD",
|
|
9308
|
+
nrarrw: "\u219D\u0338",
|
|
9309
|
+
rarrw: "\u219D",
|
|
9310
|
+
rightsquigarrow: "\u219D",
|
|
9311
|
+
larrbfs: "\u291F",
|
|
9312
|
+
rarrbfs: "\u2920",
|
|
9313
|
+
nvHarr: "\u2904",
|
|
9314
|
+
nvlArr: "\u2902",
|
|
9315
|
+
nvrArr: "\u2903",
|
|
9316
|
+
larrfs: "\u291D",
|
|
9317
|
+
rarrfs: "\u291E",
|
|
9318
|
+
Map: "\u2905",
|
|
9319
|
+
larrsim: "\u2973",
|
|
9320
|
+
rarrsim: "\u2974",
|
|
9321
|
+
harrcir: "\u2948",
|
|
9322
|
+
Uarrocir: "\u2949",
|
|
9323
|
+
lurdshar: "\u294A",
|
|
9324
|
+
ldrdhar: "\u2967",
|
|
9325
|
+
ldrushar: "\u294B",
|
|
9326
|
+
rdldhar: "\u2969",
|
|
9327
|
+
lrhard: "\u296D",
|
|
9328
|
+
rlhar: "\u21CC",
|
|
9329
|
+
uharr: "\u21BE",
|
|
9330
|
+
uharl: "\u21BF",
|
|
9331
|
+
dharr: "\u21C2",
|
|
9332
|
+
dharl: "\u21C3",
|
|
9333
|
+
Uarr: "\u219F",
|
|
9334
|
+
Darr: "\u21A1",
|
|
9335
|
+
zigrarr: "\u21DD",
|
|
9336
|
+
nwArr: "\u21D6",
|
|
9337
|
+
neArr: "\u21D7",
|
|
9338
|
+
seArr: "\u21D8",
|
|
9339
|
+
swArr: "\u21D9",
|
|
9340
|
+
nharr: "\u21AE",
|
|
9341
|
+
nhArr: "\u21CE",
|
|
9342
|
+
nlarr: "\u219A",
|
|
9343
|
+
nlArr: "\u21CD",
|
|
9344
|
+
nrarr: "\u219B",
|
|
9345
|
+
nrArr: "\u21CF",
|
|
9346
|
+
larrb: "\u21E4",
|
|
9347
|
+
LeftArrowBar: "\u21E4",
|
|
9348
|
+
rarrb: "\u21E5",
|
|
9349
|
+
RightArrowBar: "\u21E5"
|
|
9350
|
+
};
|
|
9351
|
+
var SHAPES = {
|
|
9352
|
+
square: "\u25A1",
|
|
9353
|
+
Square: "\u25A1",
|
|
9354
|
+
squ: "\u25A1",
|
|
9355
|
+
squf: "\u25AA",
|
|
9356
|
+
squarf: "\u25AA",
|
|
9357
|
+
blacksquar: "\u25AA",
|
|
9358
|
+
blacksquare: "\u25AA",
|
|
9359
|
+
FilledVerySmallSquare: "\u25AA",
|
|
9360
|
+
blk34: "\u2593",
|
|
9361
|
+
blk12: "\u2592",
|
|
9362
|
+
blk14: "\u2591",
|
|
9363
|
+
block: "\u2588",
|
|
9364
|
+
srect: "\u25AD",
|
|
9365
|
+
rect: "\u25AD",
|
|
9366
|
+
sdot: "\u22C5",
|
|
9367
|
+
sdotb: "\u22A1",
|
|
9368
|
+
dotsquare: "\u22A1",
|
|
9369
|
+
triangle: "\u25B5",
|
|
9370
|
+
tri: "\u25B5",
|
|
9371
|
+
trine: "\u25B5",
|
|
9372
|
+
utri: "\u25B5",
|
|
9373
|
+
triangledown: "\u25BF",
|
|
9374
|
+
dtri: "\u25BF",
|
|
9375
|
+
tridown: "\u25BF",
|
|
9376
|
+
triangleleft: "\u25C3",
|
|
9377
|
+
ltri: "\u25C3",
|
|
9378
|
+
triangleright: "\u25B9",
|
|
9379
|
+
rtri: "\u25B9",
|
|
9380
|
+
blacktriangle: "\u25B4",
|
|
9381
|
+
utrif: "\u25B4",
|
|
9382
|
+
blacktriangledown: "\u25BE",
|
|
9383
|
+
dtrif: "\u25BE",
|
|
9384
|
+
blacktriangleleft: "\u25C2",
|
|
9385
|
+
ltrif: "\u25C2",
|
|
9386
|
+
blacktriangleright: "\u25B8",
|
|
9387
|
+
rtrif: "\u25B8",
|
|
9388
|
+
loz: "\u25CA",
|
|
9389
|
+
lozenge: "\u25CA",
|
|
9390
|
+
blacklozenge: "\u29EB",
|
|
9391
|
+
lozf: "\u29EB",
|
|
9392
|
+
bigcirc: "\u25EF",
|
|
9393
|
+
xcirc: "\u25EF",
|
|
9394
|
+
circ: "\u02C6",
|
|
9395
|
+
Circle: "\u25CB",
|
|
9396
|
+
cir: "\u25CB",
|
|
9397
|
+
o: "\u25CB",
|
|
9398
|
+
bullet: "\u2022",
|
|
9399
|
+
bull: "\u2022",
|
|
9400
|
+
hellip: "\u2026",
|
|
9401
|
+
mldr: "\u2026",
|
|
9402
|
+
nldr: "\u2025",
|
|
9403
|
+
boxh: "\u2500",
|
|
9404
|
+
HorizontalLine: "\u2500",
|
|
9405
|
+
boxv: "\u2502",
|
|
9406
|
+
boxdr: "\u250C",
|
|
9407
|
+
boxdl: "\u2510",
|
|
9408
|
+
boxur: "\u2514",
|
|
9409
|
+
boxul: "\u2518",
|
|
9410
|
+
boxvr: "\u251C",
|
|
9411
|
+
boxvl: "\u2524",
|
|
9412
|
+
boxhd: "\u252C",
|
|
9413
|
+
boxhu: "\u2534",
|
|
9414
|
+
boxvh: "\u253C",
|
|
9415
|
+
boxH: "\u2550",
|
|
9416
|
+
boxV: "\u2551",
|
|
9417
|
+
boxdR: "\u2552",
|
|
9418
|
+
boxDr: "\u2553",
|
|
9419
|
+
boxDR: "\u2554",
|
|
9420
|
+
boxDl: "\u2555",
|
|
9421
|
+
boxdL: "\u2556",
|
|
9422
|
+
boxDL: "\u2557",
|
|
9423
|
+
boxuR: "\u2558",
|
|
9424
|
+
boxUr: "\u2559",
|
|
9425
|
+
boxUR: "\u255A",
|
|
9426
|
+
boxUl: "\u255C",
|
|
9427
|
+
boxuL: "\u255B",
|
|
9428
|
+
boxUL: "\u255D",
|
|
9429
|
+
boxvR: "\u255E",
|
|
9430
|
+
boxVr: "\u255F",
|
|
9431
|
+
boxVR: "\u2560",
|
|
9432
|
+
boxVl: "\u2562",
|
|
9433
|
+
boxvL: "\u2561",
|
|
9434
|
+
boxVL: "\u2563",
|
|
9435
|
+
boxHd: "\u2564",
|
|
9436
|
+
boxhD: "\u2565",
|
|
9437
|
+
boxHD: "\u2566",
|
|
9438
|
+
boxHu: "\u2567",
|
|
9439
|
+
boxhU: "\u2568",
|
|
9440
|
+
boxHU: "\u2569",
|
|
9441
|
+
boxvH: "\u256A",
|
|
9442
|
+
boxVh: "\u256B",
|
|
9443
|
+
boxVH: "\u256C"
|
|
9444
|
+
};
|
|
9445
|
+
var PUNCTUATION = {
|
|
9446
|
+
excl: "!",
|
|
9447
|
+
iexcl: "\xA1",
|
|
9448
|
+
brvbar: "\xA6",
|
|
9449
|
+
sect: "\xA7",
|
|
9450
|
+
uml: "\xA8",
|
|
9451
|
+
copy: "\xA9",
|
|
9452
|
+
ordf: "\xAA",
|
|
9453
|
+
laquo: "\xAB",
|
|
9454
|
+
not: "\xAC",
|
|
9455
|
+
shy: "\xAD",
|
|
9456
|
+
reg: "\xAE",
|
|
9457
|
+
macr: "\xAF",
|
|
9458
|
+
deg: "\xB0",
|
|
9459
|
+
plusmn: "\xB1",
|
|
9460
|
+
sup2: "\xB2",
|
|
9461
|
+
sup3: "\xB3",
|
|
9462
|
+
acute: "\xB4",
|
|
9463
|
+
micro: "\xB5",
|
|
9464
|
+
para: "\xB6",
|
|
9465
|
+
middot: "\xB7",
|
|
9466
|
+
cedil: "\xB8",
|
|
9467
|
+
sup1: "\xB9",
|
|
9468
|
+
ordm: "\xBA",
|
|
9469
|
+
raquo: "\xBB",
|
|
9470
|
+
frac14: "\xBC",
|
|
9471
|
+
frac12: "\xBD",
|
|
9472
|
+
frac34: "\xBE",
|
|
9473
|
+
iquest: "\xBF",
|
|
9474
|
+
nbsp: "\xA0",
|
|
9475
|
+
comma: ",",
|
|
9476
|
+
period: ".",
|
|
9477
|
+
colon: ":",
|
|
9478
|
+
semi: ";",
|
|
9479
|
+
vert: "|",
|
|
9480
|
+
Verbar: "\u2016",
|
|
9481
|
+
verbar: "|",
|
|
9482
|
+
dblac: "\u02DD",
|
|
9483
|
+
circ: "\u02C6",
|
|
9484
|
+
caron: "\u02C7",
|
|
9485
|
+
breve: "\u02D8",
|
|
9486
|
+
dot: "\u02D9",
|
|
9487
|
+
ring: "\u02DA",
|
|
9488
|
+
ogon: "\u02DB",
|
|
9489
|
+
tilde: "\u02DC",
|
|
9490
|
+
DiacriticalGrave: "`",
|
|
9491
|
+
DiacriticalAcute: "\xB4",
|
|
9492
|
+
DiacriticalTilde: "\u02DC",
|
|
9493
|
+
DiacriticalDot: "\u02D9",
|
|
9494
|
+
DiacriticalDoubleAcute: "\u02DD",
|
|
9495
|
+
grave: "`",
|
|
9496
|
+
acute: "\xB4"
|
|
9497
|
+
};
|
|
9498
|
+
var CURRENCY = {
|
|
9499
|
+
cent: "\xA2",
|
|
9500
|
+
pound: "\xA3",
|
|
9501
|
+
curren: "\xA4",
|
|
9502
|
+
yen: "\xA5",
|
|
9503
|
+
euro: "\u20AC",
|
|
9504
|
+
dollar: "$",
|
|
9505
|
+
euro: "\u20AC",
|
|
9506
|
+
fnof: "\u0192",
|
|
9507
|
+
inr: "\u20B9",
|
|
9508
|
+
af: "\u060B",
|
|
9509
|
+
birr: "\u1265\u122D",
|
|
9510
|
+
peso: "\u20B1",
|
|
9511
|
+
rub: "\u20BD",
|
|
9512
|
+
won: "\u20A9",
|
|
9513
|
+
yuan: "\xA5",
|
|
9514
|
+
cedil: "\xB8"
|
|
9515
|
+
};
|
|
9516
|
+
var FRACTIONS = {
|
|
9517
|
+
frac12: "\xBD",
|
|
9518
|
+
half: "\xBD",
|
|
9519
|
+
frac13: "\u2153",
|
|
9520
|
+
frac14: "\xBC",
|
|
9521
|
+
frac15: "\u2155",
|
|
9522
|
+
frac16: "\u2159",
|
|
9523
|
+
frac18: "\u215B",
|
|
9524
|
+
frac23: "\u2154",
|
|
9525
|
+
frac25: "\u2156",
|
|
9526
|
+
frac34: "\xBE",
|
|
9527
|
+
frac35: "\u2157",
|
|
9528
|
+
frac38: "\u215C",
|
|
9529
|
+
frac45: "\u2158",
|
|
9530
|
+
frac56: "\u215A",
|
|
9531
|
+
frac58: "\u215D",
|
|
9532
|
+
frac78: "\u215E",
|
|
9533
|
+
frasl: "\u2044"
|
|
9534
|
+
};
|
|
9535
|
+
var MISC_SYMBOLS = {
|
|
9536
|
+
trade: "\u2122",
|
|
9537
|
+
TRADE: "\u2122",
|
|
9538
|
+
telrec: "\u2315",
|
|
9539
|
+
target: "\u2316",
|
|
9540
|
+
ulcorn: "\u231C",
|
|
9541
|
+
ulcorner: "\u231C",
|
|
9542
|
+
urcorn: "\u231D",
|
|
9543
|
+
urcorner: "\u231D",
|
|
9544
|
+
dlcorn: "\u231E",
|
|
9545
|
+
llcorner: "\u231E",
|
|
9546
|
+
drcorn: "\u231F",
|
|
9547
|
+
lrcorner: "\u231F",
|
|
9548
|
+
intercal: "\u22BA",
|
|
9549
|
+
intcal: "\u22BA",
|
|
9550
|
+
oplus: "\u2295",
|
|
9551
|
+
CirclePlus: "\u2295",
|
|
9552
|
+
ominus: "\u2296",
|
|
9553
|
+
CircleMinus: "\u2296",
|
|
9554
|
+
otimes: "\u2297",
|
|
9555
|
+
CircleTimes: "\u2297",
|
|
9556
|
+
osol: "\u2298",
|
|
9557
|
+
odot: "\u2299",
|
|
9558
|
+
CircleDot: "\u2299",
|
|
9559
|
+
oast: "\u229B",
|
|
9560
|
+
circledast: "\u229B",
|
|
9561
|
+
odash: "\u229D",
|
|
9562
|
+
circleddash: "\u229D",
|
|
9563
|
+
ocirc: "\u229A",
|
|
9564
|
+
circledcirc: "\u229A",
|
|
9565
|
+
boxplus: "\u229E",
|
|
9566
|
+
plusb: "\u229E",
|
|
9567
|
+
boxminus: "\u229F",
|
|
9568
|
+
minusb: "\u229F",
|
|
9569
|
+
boxtimes: "\u22A0",
|
|
9570
|
+
timesb: "\u22A0",
|
|
9571
|
+
boxdot: "\u22A1",
|
|
9572
|
+
sdotb: "\u22A1",
|
|
9573
|
+
veebar: "\u22BB",
|
|
9574
|
+
vee: "\u2228",
|
|
9575
|
+
barvee: "\u22BD",
|
|
9576
|
+
and: "\u2227",
|
|
9577
|
+
wedge: "\u2227",
|
|
9578
|
+
Cap: "\u22D2",
|
|
9579
|
+
Cup: "\u22D3",
|
|
9580
|
+
Fork: "\u22D4",
|
|
9581
|
+
pitchfork: "\u22D4",
|
|
9582
|
+
epar: "\u22D5",
|
|
9583
|
+
ltlarr: "\u2976",
|
|
9584
|
+
nvap: "\u224D\u20D2",
|
|
9585
|
+
nvsim: "\u223C\u20D2",
|
|
9586
|
+
nvge: "\u2265\u20D2",
|
|
9587
|
+
nvle: "\u2264\u20D2",
|
|
9588
|
+
nvlt: "<\u20D2",
|
|
9589
|
+
nvgt: ">\u20D2",
|
|
9590
|
+
nvltrie: "\u22B4\u20D2",
|
|
9591
|
+
nvrtrie: "\u22B5\u20D2",
|
|
9592
|
+
Vdash: "\u22A9",
|
|
9593
|
+
dashv: "\u22A3",
|
|
9594
|
+
vDash: "\u22A8",
|
|
9595
|
+
Vdash: "\u22A9",
|
|
9596
|
+
Vvdash: "\u22AA",
|
|
9597
|
+
nvdash: "\u22AC",
|
|
9598
|
+
nvDash: "\u22AD",
|
|
9599
|
+
nVdash: "\u22AE",
|
|
9600
|
+
nVDash: "\u22AF"
|
|
9601
|
+
};
|
|
9602
|
+
var ALL_ENTITIES = {
|
|
9603
|
+
...BASIC_LATIN,
|
|
9604
|
+
...LATIN_ACCENTS,
|
|
9605
|
+
...LATIN_EXTENDED,
|
|
9606
|
+
...GREEK,
|
|
9607
|
+
...CYRILLIC,
|
|
9608
|
+
...MATH,
|
|
9609
|
+
...MATH_ADVANCED,
|
|
9610
|
+
...ARROWS,
|
|
9611
|
+
...SHAPES,
|
|
9612
|
+
...PUNCTUATION,
|
|
9613
|
+
...CURRENCY,
|
|
9614
|
+
...FRACTIONS,
|
|
9615
|
+
...MISC_SYMBOLS
|
|
9616
|
+
};
|
|
9617
|
+
var XML = {
|
|
9618
|
+
amp: "&",
|
|
9619
|
+
apos: "'",
|
|
9620
|
+
gt: ">",
|
|
9621
|
+
lt: "<",
|
|
9622
|
+
quot: '"'
|
|
9623
|
+
};
|
|
9624
|
+
var COMMON_HTML = {
|
|
9625
|
+
nbsp: "\xA0",
|
|
9626
|
+
copy: "\xA9",
|
|
9627
|
+
reg: "\xAE",
|
|
9628
|
+
trade: "\u2122",
|
|
9629
|
+
mdash: "\u2014",
|
|
9630
|
+
ndash: "\u2013",
|
|
9631
|
+
hellip: "\u2026",
|
|
9632
|
+
laquo: "\xAB",
|
|
9633
|
+
raquo: "\xBB",
|
|
9634
|
+
lsquo: "\u2018",
|
|
9635
|
+
rsquo: "\u2019",
|
|
9636
|
+
ldquo: "\u201C",
|
|
9637
|
+
rdquo: "\u201D",
|
|
9638
|
+
bull: "\u2022",
|
|
9639
|
+
para: "\xB6",
|
|
9640
|
+
sect: "\xA7",
|
|
9641
|
+
deg: "\xB0",
|
|
9642
|
+
frac12: "\xBD",
|
|
9643
|
+
frac14: "\xBC",
|
|
9644
|
+
frac34: "\xBE"
|
|
9645
|
+
};
|
|
9646
|
+
|
|
9647
|
+
// ../../.yarn/cache/@nodable-entities-npm-2.1.0-6eb9f06ac0-355c55e82a.zip/node_modules/@nodable/entities/src/EntityDecoder.js
|
|
9648
|
+
var SPECIAL_CHARS = new Set("!?\\\\/[]$%{}^&*()<>|+");
|
|
9649
|
+
function validateEntityName(name) {
|
|
9650
|
+
if (name[0] === "#") {
|
|
9651
|
+
throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${name}"`);
|
|
9652
|
+
}
|
|
9653
|
+
for (const ch of name) {
|
|
9654
|
+
if (SPECIAL_CHARS.has(ch)) {
|
|
9655
|
+
throw new Error(`[EntityReplacer] Invalid character '${ch}' in entity name: "${name}"`);
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
return name;
|
|
9659
|
+
}
|
|
9660
|
+
function mergeEntityMaps(...maps) {
|
|
9661
|
+
const out = /* @__PURE__ */ Object.create(null);
|
|
9662
|
+
for (const map2 of maps) {
|
|
9663
|
+
if (!map2) continue;
|
|
9664
|
+
for (const key of Object.keys(map2)) {
|
|
9665
|
+
const raw = map2[key];
|
|
9666
|
+
if (typeof raw === "string") {
|
|
9667
|
+
out[key] = raw;
|
|
9668
|
+
} else if (raw && typeof raw === "object" && raw.val !== void 0) {
|
|
9669
|
+
const val = raw.val;
|
|
9670
|
+
if (typeof val === "string") {
|
|
9671
|
+
out[key] = val;
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
}
|
|
9675
|
+
}
|
|
9676
|
+
return out;
|
|
9677
|
+
}
|
|
9678
|
+
var LIMIT_TIER_EXTERNAL = "external";
|
|
9679
|
+
var LIMIT_TIER_BASE = "base";
|
|
9680
|
+
var LIMIT_TIER_ALL = "all";
|
|
9681
|
+
function parseLimitTiers(raw) {
|
|
9682
|
+
if (!raw || raw === LIMIT_TIER_EXTERNAL) return /* @__PURE__ */ new Set([LIMIT_TIER_EXTERNAL]);
|
|
9683
|
+
if (raw === LIMIT_TIER_ALL) return /* @__PURE__ */ new Set([LIMIT_TIER_ALL]);
|
|
9684
|
+
if (raw === LIMIT_TIER_BASE) return /* @__PURE__ */ new Set([LIMIT_TIER_BASE]);
|
|
9685
|
+
if (Array.isArray(raw)) return new Set(raw);
|
|
9686
|
+
return /* @__PURE__ */ new Set([LIMIT_TIER_EXTERNAL]);
|
|
9687
|
+
}
|
|
9688
|
+
var NCR_LEVEL = Object.freeze({ allow: 0, leave: 1, remove: 2, throw: 3 });
|
|
9689
|
+
var XML10_ALLOWED_C0 = /* @__PURE__ */ new Set([9, 10, 13]);
|
|
9690
|
+
function parseNCRConfig(ncr) {
|
|
9691
|
+
if (!ncr) {
|
|
9692
|
+
return { xmlVersion: 1, onLevel: NCR_LEVEL.allow, nullLevel: NCR_LEVEL.remove };
|
|
9693
|
+
}
|
|
9694
|
+
const xmlVersion = ncr.xmlVersion === 1.1 ? 1.1 : 1;
|
|
9695
|
+
const onLevel = NCR_LEVEL[ncr.onNCR] ?? NCR_LEVEL.allow;
|
|
9696
|
+
const nullLevel = NCR_LEVEL[ncr.nullNCR] ?? NCR_LEVEL.remove;
|
|
9697
|
+
const clampedNull = Math.max(nullLevel, NCR_LEVEL.remove);
|
|
9698
|
+
return { xmlVersion, onLevel, nullLevel: clampedNull };
|
|
9699
|
+
}
|
|
9700
|
+
var EntityDecoder = class {
|
|
9701
|
+
/**
|
|
9702
|
+
* @param {object} [options]
|
|
9703
|
+
* @param {object|null} [options.namedEntities] — extra named entities merged into base map
|
|
9704
|
+
* @param {object} [options.limit] — security limits
|
|
9705
|
+
* @param {number} [options.limit.maxTotalExpansions=0] — 0 = unlimited
|
|
9706
|
+
* @param {number} [options.limit.maxExpandedLength=0] — 0 = unlimited
|
|
9707
|
+
* @param {'external'|'base'|'all'|string[]} [options.limit.applyLimitsTo='external']
|
|
9708
|
+
* Which entity tiers count against the security limits:
|
|
9709
|
+
* - 'external' (default) — only input/runtime + persistent external entities
|
|
9710
|
+
* - 'base' — only DEFAULT_XML_ENTITIES + namedEntities
|
|
9711
|
+
* - 'all' — every entity regardless of tier
|
|
9712
|
+
* - string[] — explicit combination, e.g. ['external', 'base']
|
|
9713
|
+
* @param {((resolved: string, original: string) => string)|null} [options.postCheck=null]
|
|
9714
|
+
* @param {string[]} [options.remove=[]] — entity names (e.g. ['nbsp', '#13']) to delete (replace with empty string)
|
|
9715
|
+
* @param {string[]} [options.leave=[]] — entity names to keep as literal (unchanged in output)
|
|
9716
|
+
* @param {object} [options.ncr] — Numeric Character Reference controls
|
|
9717
|
+
* @param {1.0|1.1} [options.ncr.xmlVersion=1.0]
|
|
9718
|
+
* XML version governing which codepoint ranges are restricted:
|
|
9719
|
+
* - 1.0 — C0 controls U+0001–U+001F (except U+0009/000A/000D) are prohibited
|
|
9720
|
+
* - 1.1 — C0 controls are allowed when written as NCRs; C1 (U+007F–U+009F) decoded as-is
|
|
9721
|
+
* @param {'allow'|'leave'|'remove'|'throw'} [options.ncr.onNCR='allow']
|
|
9722
|
+
* Base action for numeric references. Severity order: allow < leave < remove < throw.
|
|
9723
|
+
* For codepoint ranges that carry a minimum level (surrogates → remove, XML 1.0 C0 → remove),
|
|
9724
|
+
* the effective action is max(onNCR, rangeMinimum).
|
|
9725
|
+
* @param {'remove'|'throw'} [options.ncr.nullNCR='remove']
|
|
9726
|
+
* Action for U+0000 (null). 'allow' and 'leave' are clamped to 'remove' since null is never safe.
|
|
9727
|
+
*/
|
|
9728
|
+
constructor(options2 = {}) {
|
|
9729
|
+
this._limit = options2.limit || {};
|
|
9730
|
+
this._maxTotalExpansions = this._limit.maxTotalExpansions || 0;
|
|
9731
|
+
this._maxExpandedLength = this._limit.maxExpandedLength || 0;
|
|
9732
|
+
this._postCheck = typeof options2.postCheck === "function" ? options2.postCheck : (r) => r;
|
|
9733
|
+
this._limitTiers = parseLimitTiers(this._limit.applyLimitsTo ?? LIMIT_TIER_EXTERNAL);
|
|
9734
|
+
this._numericAllowed = options2.numericAllowed ?? true;
|
|
9735
|
+
this._baseMap = mergeEntityMaps(XML, options2.namedEntities || null);
|
|
9736
|
+
this._externalMap = /* @__PURE__ */ Object.create(null);
|
|
9737
|
+
this._inputMap = /* @__PURE__ */ Object.create(null);
|
|
9738
|
+
this._totalExpansions = 0;
|
|
9739
|
+
this._expandedLength = 0;
|
|
9740
|
+
this._removeSet = new Set(options2.remove && Array.isArray(options2.remove) ? options2.remove : []);
|
|
9741
|
+
this._leaveSet = new Set(options2.leave && Array.isArray(options2.leave) ? options2.leave : []);
|
|
9742
|
+
const ncrCfg = parseNCRConfig(options2.ncr);
|
|
9743
|
+
this._ncrXmlVersion = ncrCfg.xmlVersion;
|
|
9744
|
+
this._ncrOnLevel = ncrCfg.onLevel;
|
|
9745
|
+
this._ncrNullLevel = ncrCfg.nullLevel;
|
|
9746
|
+
}
|
|
9747
|
+
// -------------------------------------------------------------------------
|
|
9748
|
+
// Persistent external entity registration
|
|
9749
|
+
// -------------------------------------------------------------------------
|
|
9750
|
+
/**
|
|
9751
|
+
* Replace the full set of persistent external entities.
|
|
9752
|
+
* All keys are validated — throws on invalid characters.
|
|
9753
|
+
* @param {Record<string, string | { regex?: RegExp, val: string }>} map
|
|
9754
|
+
*/
|
|
9755
|
+
setExternalEntities(map2) {
|
|
9756
|
+
if (map2) {
|
|
9757
|
+
for (const key of Object.keys(map2)) {
|
|
9758
|
+
validateEntityName(key);
|
|
9759
|
+
}
|
|
9760
|
+
}
|
|
9761
|
+
this._externalMap = mergeEntityMaps(map2);
|
|
9762
|
+
}
|
|
9763
|
+
/**
|
|
9764
|
+
* Add a single persistent external entity.
|
|
9765
|
+
* @param {string} key
|
|
9766
|
+
* @param {string} value
|
|
9767
|
+
*/
|
|
9768
|
+
addExternalEntity(key, value) {
|
|
9769
|
+
validateEntityName(key);
|
|
9770
|
+
if (typeof value === "string" && value.indexOf("&") === -1) {
|
|
9771
|
+
this._externalMap[key] = value;
|
|
9772
|
+
}
|
|
9773
|
+
}
|
|
9774
|
+
// -------------------------------------------------------------------------
|
|
9775
|
+
// Input / runtime entity registration (per document)
|
|
9776
|
+
// -------------------------------------------------------------------------
|
|
9777
|
+
/**
|
|
9778
|
+
* Inject DOCTYPE entities for the current document.
|
|
9779
|
+
* Also resets per-document expansion counters.
|
|
9780
|
+
* @param {Record<string, string | { regx?: RegExp, regex?: RegExp, val: string }>} map
|
|
9781
|
+
*/
|
|
9782
|
+
addInputEntities(map2) {
|
|
9783
|
+
this._totalExpansions = 0;
|
|
9784
|
+
this._expandedLength = 0;
|
|
9785
|
+
this._inputMap = mergeEntityMaps(map2);
|
|
9786
|
+
}
|
|
9787
|
+
// -------------------------------------------------------------------------
|
|
9788
|
+
// Per-document reset
|
|
9789
|
+
// -------------------------------------------------------------------------
|
|
9790
|
+
/**
|
|
9791
|
+
* Wipe input/runtime entities and reset counters.
|
|
9792
|
+
* Call this before processing each new document.
|
|
9793
|
+
* @returns {this}
|
|
9794
|
+
*/
|
|
9795
|
+
reset() {
|
|
9796
|
+
this._inputMap = /* @__PURE__ */ Object.create(null);
|
|
9797
|
+
this._totalExpansions = 0;
|
|
9798
|
+
this._expandedLength = 0;
|
|
9799
|
+
return this;
|
|
9800
|
+
}
|
|
9801
|
+
// -------------------------------------------------------------------------
|
|
9802
|
+
// XML version (can be set after construction, e.g. once parser reads <?xml?>)
|
|
9803
|
+
// -------------------------------------------------------------------------
|
|
9804
|
+
/**
|
|
9805
|
+
* Update the XML version used for NCR classification.
|
|
9806
|
+
* Call this as soon as the document's `<?xml version="...">` declaration is parsed.
|
|
9807
|
+
* @param {1.0|1.1|number} version
|
|
9808
|
+
*/
|
|
9809
|
+
setXmlVersion(version) {
|
|
9810
|
+
this._ncrXmlVersion = version === 1.1 ? 1.1 : 1;
|
|
9811
|
+
}
|
|
9812
|
+
// -------------------------------------------------------------------------
|
|
9813
|
+
// Primary API
|
|
9814
|
+
// -------------------------------------------------------------------------
|
|
9815
|
+
/**
|
|
9816
|
+
* Replace all entity references in `str` in a single pass.
|
|
9817
|
+
*
|
|
9818
|
+
* @param {string} str
|
|
9819
|
+
* @returns {string}
|
|
9820
|
+
*/
|
|
9821
|
+
decode(str) {
|
|
9822
|
+
if (typeof str !== "string" || str.length === 0) return str;
|
|
9823
|
+
const original = str;
|
|
9824
|
+
const chunks = [];
|
|
9825
|
+
const len = str.length;
|
|
9826
|
+
let last = 0;
|
|
9827
|
+
let i = 0;
|
|
9828
|
+
const limitExpansions = this._maxTotalExpansions > 0;
|
|
9829
|
+
const limitLength = this._maxExpandedLength > 0;
|
|
9830
|
+
const checkLimits = limitExpansions || limitLength;
|
|
9831
|
+
while (i < len) {
|
|
9832
|
+
if (str.charCodeAt(i) !== 38) {
|
|
9833
|
+
i++;
|
|
9834
|
+
continue;
|
|
9835
|
+
}
|
|
9836
|
+
let j = i + 1;
|
|
9837
|
+
while (j < len && str.charCodeAt(j) !== 59 && j - i <= 32) j++;
|
|
9838
|
+
if (j >= len || str.charCodeAt(j) !== 59) {
|
|
9839
|
+
i++;
|
|
9840
|
+
continue;
|
|
9841
|
+
}
|
|
9842
|
+
const token = str.slice(i + 1, j);
|
|
9843
|
+
if (token.length === 0) {
|
|
9844
|
+
i++;
|
|
9845
|
+
continue;
|
|
9846
|
+
}
|
|
9847
|
+
let replacement;
|
|
9848
|
+
let tier;
|
|
9849
|
+
if (this._removeSet.has(token)) {
|
|
9850
|
+
replacement = "";
|
|
9851
|
+
if (tier === void 0) {
|
|
9852
|
+
tier = LIMIT_TIER_EXTERNAL;
|
|
9853
|
+
}
|
|
9854
|
+
} else if (this._leaveSet.has(token)) {
|
|
9855
|
+
i++;
|
|
9856
|
+
continue;
|
|
9857
|
+
} else if (token.charCodeAt(0) === 35) {
|
|
9858
|
+
const ncrResult = this._resolveNCR(token);
|
|
9859
|
+
if (ncrResult === void 0) {
|
|
9860
|
+
i++;
|
|
9861
|
+
continue;
|
|
9862
|
+
}
|
|
9863
|
+
replacement = ncrResult;
|
|
9864
|
+
tier = LIMIT_TIER_BASE;
|
|
9865
|
+
} else {
|
|
9866
|
+
const resolved = this._resolveName(token);
|
|
9867
|
+
replacement = resolved?.value;
|
|
9868
|
+
tier = resolved?.tier;
|
|
9869
|
+
}
|
|
9870
|
+
if (replacement === void 0) {
|
|
9871
|
+
i++;
|
|
9872
|
+
continue;
|
|
9873
|
+
}
|
|
9874
|
+
if (i > last) chunks.push(str.slice(last, i));
|
|
9875
|
+
chunks.push(replacement);
|
|
9876
|
+
last = j + 1;
|
|
9877
|
+
i = last;
|
|
9878
|
+
if (checkLimits && this._tierCounts(tier)) {
|
|
9879
|
+
if (limitExpansions) {
|
|
9880
|
+
this._totalExpansions++;
|
|
9881
|
+
if (this._totalExpansions > this._maxTotalExpansions) {
|
|
9882
|
+
throw new Error(
|
|
9883
|
+
`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`
|
|
9884
|
+
);
|
|
9885
|
+
}
|
|
9886
|
+
}
|
|
9887
|
+
if (limitLength) {
|
|
9888
|
+
const delta = replacement.length - (token.length + 2);
|
|
9889
|
+
if (delta > 0) {
|
|
9890
|
+
this._expandedLength += delta;
|
|
9891
|
+
if (this._expandedLength > this._maxExpandedLength) {
|
|
9892
|
+
throw new Error(
|
|
9893
|
+
`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`
|
|
9894
|
+
);
|
|
9895
|
+
}
|
|
9896
|
+
}
|
|
9897
|
+
}
|
|
9898
|
+
}
|
|
9899
|
+
}
|
|
9900
|
+
if (last < len) chunks.push(str.slice(last));
|
|
9901
|
+
const result = chunks.length === 0 ? str : chunks.join("");
|
|
9902
|
+
return this._postCheck(result, original);
|
|
9903
|
+
}
|
|
9904
|
+
// -------------------------------------------------------------------------
|
|
9905
|
+
// Private: limit tier check
|
|
9906
|
+
// -------------------------------------------------------------------------
|
|
9907
|
+
/**
|
|
9908
|
+
* Returns true if a resolved entity of the given tier should count
|
|
9909
|
+
* against the expansion/length limits.
|
|
9910
|
+
* @param {string} tier — LIMIT_TIER_EXTERNAL | LIMIT_TIER_BASE
|
|
9911
|
+
* @returns {boolean}
|
|
9912
|
+
*/
|
|
9913
|
+
_tierCounts(tier) {
|
|
9914
|
+
if (this._limitTiers.has(LIMIT_TIER_ALL)) return true;
|
|
9915
|
+
return this._limitTiers.has(tier);
|
|
9916
|
+
}
|
|
9917
|
+
// -------------------------------------------------------------------------
|
|
9918
|
+
// Private: entity resolution
|
|
9919
|
+
// -------------------------------------------------------------------------
|
|
9920
|
+
/**
|
|
9921
|
+
* Resolve a named entity token (without & and ;).
|
|
9922
|
+
* Priority: inputMap > externalMap > baseMap
|
|
9923
|
+
* Returns the resolved value tagged with its limit tier.
|
|
9924
|
+
*
|
|
9925
|
+
* @param {string} name
|
|
9926
|
+
* @returns {{ value: string, tier: string }|undefined}
|
|
9927
|
+
*/
|
|
9928
|
+
_resolveName(name) {
|
|
9929
|
+
if (name in this._inputMap) return { value: this._inputMap[name], tier: LIMIT_TIER_EXTERNAL };
|
|
9930
|
+
if (name in this._externalMap) return { value: this._externalMap[name], tier: LIMIT_TIER_EXTERNAL };
|
|
9931
|
+
if (name in this._baseMap) return { value: this._baseMap[name], tier: LIMIT_TIER_BASE };
|
|
9932
|
+
return void 0;
|
|
9933
|
+
}
|
|
9934
|
+
/**
|
|
9935
|
+
* Classify a codepoint and return the minimum action level that must be applied.
|
|
9936
|
+
* Returns -1 when no minimum is imposed (normal allow path).
|
|
9937
|
+
*
|
|
9938
|
+
* Ranges checked (in priority order):
|
|
9939
|
+
* 1. U+0000 — null, governed by nullNCR (always ≥ remove)
|
|
9940
|
+
* 2. U+D800–U+DFFF — surrogates, always prohibited (min: remove)
|
|
9941
|
+
* 3. U+0001–U+001F \ {0x09,0x0A,0x0D} — XML 1.0 restricted C0 (min: remove)
|
|
9942
|
+
* (skipped in XML 1.1 — C0 controls are allowed when written as NCRs)
|
|
9943
|
+
*
|
|
9944
|
+
* @param {number} cp — codepoint
|
|
9945
|
+
* @returns {number} — minimum NCR_LEVEL value, or -1 for no restriction
|
|
9946
|
+
*/
|
|
9947
|
+
_classifyNCR(cp) {
|
|
9948
|
+
if (cp === 0) return this._ncrNullLevel;
|
|
9949
|
+
if (cp >= 55296 && cp <= 57343) return NCR_LEVEL.remove;
|
|
9950
|
+
if (this._ncrXmlVersion === 1) {
|
|
9951
|
+
if (cp >= 1 && cp <= 31 && !XML10_ALLOWED_C0.has(cp)) return NCR_LEVEL.remove;
|
|
9952
|
+
}
|
|
9953
|
+
return -1;
|
|
9954
|
+
}
|
|
9955
|
+
/**
|
|
9956
|
+
* Execute a resolved NCR action.
|
|
9957
|
+
*
|
|
9958
|
+
* @param {number} action — NCR_LEVEL value
|
|
9959
|
+
* @param {string} token — raw token (e.g. '#38') for error messages
|
|
9960
|
+
* @param {number} cp — codepoint, used only for error messages
|
|
9961
|
+
* @returns {string|undefined}
|
|
9962
|
+
* - decoded character string → 'allow'
|
|
9963
|
+
* - '' → 'remove'
|
|
9964
|
+
* - undefined → 'leave' (caller must skip past '&' only)
|
|
9965
|
+
* - throws Error → 'throw'
|
|
9966
|
+
*/
|
|
9967
|
+
_applyNCRAction(action, token, cp) {
|
|
9968
|
+
switch (action) {
|
|
9969
|
+
case NCR_LEVEL.allow:
|
|
9970
|
+
return String.fromCodePoint(cp);
|
|
9971
|
+
case NCR_LEVEL.remove:
|
|
9972
|
+
return "";
|
|
9973
|
+
case NCR_LEVEL.leave:
|
|
9974
|
+
return void 0;
|
|
9975
|
+
// signal: keep literal
|
|
9976
|
+
case NCR_LEVEL.throw:
|
|
9977
|
+
throw new Error(
|
|
9978
|
+
`[EntityDecoder] Prohibited numeric character reference &${token}; (U+${cp.toString(16).toUpperCase().padStart(4, "0")})`
|
|
9979
|
+
);
|
|
9980
|
+
default:
|
|
9981
|
+
return String.fromCodePoint(cp);
|
|
9982
|
+
}
|
|
9983
|
+
}
|
|
9984
|
+
/**
|
|
9985
|
+
* Full NCR resolution pipeline for a numeric token.
|
|
9986
|
+
*
|
|
9987
|
+
* Steps:
|
|
9988
|
+
* 1. Parse the codepoint (decimal or hex).
|
|
9989
|
+
* 2. Validate the raw codepoint range (NaN, <0, >0x10FFFF).
|
|
9990
|
+
* 3. If numericAllowed is false and no minimum restriction applies → leave as-is.
|
|
9991
|
+
* 4. Classify the codepoint to find the minimum required action level.
|
|
9992
|
+
* 5. Resolve effective action = max(onNCR, minimum).
|
|
9993
|
+
* 6. Apply and return.
|
|
9994
|
+
*
|
|
9995
|
+
* @param {string} token — e.g. '#38', '#x26', '#X26'
|
|
9996
|
+
* @returns {string|undefined}
|
|
9997
|
+
* - string (incl. '') — replacement ('' = remove)
|
|
9998
|
+
* - undefined — leave original &token; as-is
|
|
9999
|
+
*/
|
|
10000
|
+
_resolveNCR(token) {
|
|
10001
|
+
const second = token.charCodeAt(1);
|
|
10002
|
+
let cp;
|
|
10003
|
+
if (second === 120 || second === 88) {
|
|
10004
|
+
cp = parseInt(token.slice(2), 16);
|
|
10005
|
+
} else {
|
|
10006
|
+
cp = parseInt(token.slice(1), 10);
|
|
10007
|
+
}
|
|
10008
|
+
if (Number.isNaN(cp) || cp < 0 || cp > 1114111) return void 0;
|
|
10009
|
+
const minimum = this._classifyNCR(cp);
|
|
10010
|
+
if (!this._numericAllowed && minimum < NCR_LEVEL.remove) return void 0;
|
|
10011
|
+
const effective = minimum === -1 ? this._ncrOnLevel : Math.max(this._ncrOnLevel, minimum);
|
|
10012
|
+
return this._applyNCRAction(effective, token, cp);
|
|
10013
|
+
}
|
|
10014
|
+
};
|
|
10015
|
+
|
|
10016
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
|
|
8548
10017
|
var defaultOnDangerousProperty = (name) => {
|
|
8549
10018
|
if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
|
|
8550
10019
|
return "__" + name;
|
|
@@ -8586,6 +10055,7 @@ var defaultOptions2 = {
|
|
|
8586
10055
|
unpairedTags: [],
|
|
8587
10056
|
processEntities: true,
|
|
8588
10057
|
htmlEntities: false,
|
|
10058
|
+
entityDecoder: null,
|
|
8589
10059
|
ignoreDeclaration: false,
|
|
8590
10060
|
ignorePiTags: false,
|
|
8591
10061
|
transformTagName: false,
|
|
@@ -8617,18 +10087,19 @@ function validatePropertyName(propertyName, optionName) {
|
|
|
8617
10087
|
);
|
|
8618
10088
|
}
|
|
8619
10089
|
}
|
|
8620
|
-
function normalizeProcessEntities(value) {
|
|
10090
|
+
function normalizeProcessEntities(value, htmlEntities) {
|
|
8621
10091
|
if (typeof value === "boolean") {
|
|
8622
10092
|
return {
|
|
8623
10093
|
enabled: value,
|
|
8624
10094
|
// true or false
|
|
8625
10095
|
maxEntitySize: 1e4,
|
|
8626
|
-
maxExpansionDepth:
|
|
8627
|
-
maxTotalExpansions:
|
|
10096
|
+
maxExpansionDepth: 1e4,
|
|
10097
|
+
maxTotalExpansions: Infinity,
|
|
8628
10098
|
maxExpandedLength: 1e5,
|
|
8629
|
-
maxEntityCount:
|
|
10099
|
+
maxEntityCount: 1e3,
|
|
8630
10100
|
allowedTags: null,
|
|
8631
|
-
tagFilter: null
|
|
10101
|
+
tagFilter: null,
|
|
10102
|
+
appliesTo: "all"
|
|
8632
10103
|
};
|
|
8633
10104
|
}
|
|
8634
10105
|
if (typeof value === "object" && value !== null) {
|
|
@@ -8640,7 +10111,8 @@ function normalizeProcessEntities(value) {
|
|
|
8640
10111
|
maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
|
|
8641
10112
|
maxEntityCount: Math.max(1, value.maxEntityCount ?? 1e3),
|
|
8642
10113
|
allowedTags: value.allowedTags ?? null,
|
|
8643
|
-
tagFilter: value.tagFilter ?? null
|
|
10114
|
+
tagFilter: value.tagFilter ?? null,
|
|
10115
|
+
appliesTo: value.appliesTo ?? "all"
|
|
8644
10116
|
};
|
|
8645
10117
|
}
|
|
8646
10118
|
return normalizeProcessEntities(true);
|
|
@@ -8662,7 +10134,8 @@ var buildOptions = function(options2) {
|
|
|
8662
10134
|
if (built.onDangerousProperty === null) {
|
|
8663
10135
|
built.onDangerousProperty = defaultOnDangerousProperty;
|
|
8664
10136
|
}
|
|
8665
|
-
built.processEntities = normalizeProcessEntities(built.processEntities);
|
|
10137
|
+
built.processEntities = normalizeProcessEntities(built.processEntities, built.htmlEntities);
|
|
10138
|
+
built.unpairedTagsSet = new Set(built.unpairedTags);
|
|
8666
10139
|
if (built.stopNodes && Array.isArray(built.stopNodes)) {
|
|
8667
10140
|
built.stopNodes = built.stopNodes.map((node) => {
|
|
8668
10141
|
if (typeof node === "string" && node.startsWith("*.")) {
|
|
@@ -8674,7 +10147,7 @@ var buildOptions = function(options2) {
|
|
|
8674
10147
|
return built;
|
|
8675
10148
|
};
|
|
8676
10149
|
|
|
8677
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
10150
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
|
|
8678
10151
|
var METADATA_SYMBOL;
|
|
8679
10152
|
if (typeof Symbol !== "function") {
|
|
8680
10153
|
METADATA_SYMBOL = "@@xmlMetadata";
|
|
@@ -8708,7 +10181,7 @@ var XmlNode = class {
|
|
|
8708
10181
|
}
|
|
8709
10182
|
};
|
|
8710
10183
|
|
|
8711
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
10184
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
|
|
8712
10185
|
var DocTypeReader = class {
|
|
8713
10186
|
constructor(options2) {
|
|
8714
10187
|
this.suppressValidationErr = !options2;
|
|
@@ -8734,11 +10207,7 @@ var DocTypeReader = class {
|
|
|
8734
10207
|
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
8735
10208
|
);
|
|
8736
10209
|
}
|
|
8737
|
-
|
|
8738
|
-
entities[entityName] = {
|
|
8739
|
-
regx: RegExp(`&${escaped};`, "g"),
|
|
8740
|
-
val
|
|
8741
|
-
};
|
|
10210
|
+
entities[entityName] = val;
|
|
8742
10211
|
entityCount++;
|
|
8743
10212
|
}
|
|
8744
10213
|
} else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
|
|
@@ -8788,7 +10257,7 @@ var DocTypeReader = class {
|
|
|
8788
10257
|
i++;
|
|
8789
10258
|
}
|
|
8790
10259
|
let entityName = xmlData.substring(startIndex, i);
|
|
8791
|
-
|
|
10260
|
+
validateEntityName2(entityName);
|
|
8792
10261
|
i = skipWhitespace(xmlData, i);
|
|
8793
10262
|
if (!this.suppressValidationErr) {
|
|
8794
10263
|
if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
|
|
@@ -8814,7 +10283,7 @@ var DocTypeReader = class {
|
|
|
8814
10283
|
i++;
|
|
8815
10284
|
}
|
|
8816
10285
|
let notationName = xmlData.substring(startIndex, i);
|
|
8817
|
-
!this.suppressValidationErr &&
|
|
10286
|
+
!this.suppressValidationErr && validateEntityName2(notationName);
|
|
8818
10287
|
i = skipWhitespace(xmlData, i);
|
|
8819
10288
|
const identifierType = xmlData.substring(i, i + 6).toUpperCase();
|
|
8820
10289
|
if (!this.suppressValidationErr && identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
|
|
@@ -8896,14 +10365,14 @@ var DocTypeReader = class {
|
|
|
8896
10365
|
i++;
|
|
8897
10366
|
}
|
|
8898
10367
|
let elementName = xmlData.substring(startIndex, i);
|
|
8899
|
-
|
|
10368
|
+
validateEntityName2(elementName);
|
|
8900
10369
|
i = skipWhitespace(xmlData, i);
|
|
8901
10370
|
startIndex = i;
|
|
8902
10371
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
8903
10372
|
i++;
|
|
8904
10373
|
}
|
|
8905
10374
|
let attributeName = xmlData.substring(startIndex, i);
|
|
8906
|
-
if (!
|
|
10375
|
+
if (!validateEntityName2(attributeName)) {
|
|
8907
10376
|
throw new Error(`Invalid attribute name: "${attributeName}"`);
|
|
8908
10377
|
}
|
|
8909
10378
|
i = skipWhitespace(xmlData, i);
|
|
@@ -8924,7 +10393,7 @@ var DocTypeReader = class {
|
|
|
8924
10393
|
}
|
|
8925
10394
|
let notation = xmlData.substring(startIndex2, i);
|
|
8926
10395
|
notation = notation.trim();
|
|
8927
|
-
if (!
|
|
10396
|
+
if (!validateEntityName2(notation)) {
|
|
8928
10397
|
throw new Error(`Invalid notation name: "${notation}"`);
|
|
8929
10398
|
}
|
|
8930
10399
|
allowedNotations.push(notation);
|
|
@@ -8981,14 +10450,14 @@ function hasSeq(data, seq, i) {
|
|
|
8981
10450
|
}
|
|
8982
10451
|
return true;
|
|
8983
10452
|
}
|
|
8984
|
-
function
|
|
10453
|
+
function validateEntityName2(name) {
|
|
8985
10454
|
if (isName(name))
|
|
8986
10455
|
return name;
|
|
8987
10456
|
else
|
|
8988
10457
|
throw new Error(`Invalid entity name ${name}`);
|
|
8989
10458
|
}
|
|
8990
10459
|
|
|
8991
|
-
// ../../.yarn/cache/strnum-npm-2.2.
|
|
10460
|
+
// ../../.yarn/cache/strnum-npm-2.2.3-3aa06fd3c4-fb70206301.zip/node_modules/strnum/strnum.js
|
|
8992
10461
|
var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
8993
10462
|
var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
8994
10463
|
var consider = {
|
|
@@ -9110,7 +10579,7 @@ function handleInfinity(str, num, options2) {
|
|
|
9110
10579
|
}
|
|
9111
10580
|
}
|
|
9112
10581
|
|
|
9113
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
10582
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
|
|
9114
10583
|
function getIgnoreAttributesFn(ignoreAttributes) {
|
|
9115
10584
|
if (typeof ignoreAttributes === "function") {
|
|
9116
10585
|
return ignoreAttributes;
|
|
@@ -9130,7 +10599,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
|
|
|
9130
10599
|
return () => false;
|
|
9131
10600
|
}
|
|
9132
10601
|
|
|
9133
|
-
// ../../.yarn/cache/path-expression-matcher-npm-1.
|
|
10602
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/Expression.js
|
|
9134
10603
|
var Expression = class {
|
|
9135
10604
|
/**
|
|
9136
10605
|
* Create a new Expression
|
|
@@ -9138,10 +10607,11 @@ var Expression = class {
|
|
|
9138
10607
|
* @param {Object} options - Configuration options
|
|
9139
10608
|
* @param {string} options.separator - Path separator (default: '.')
|
|
9140
10609
|
*/
|
|
9141
|
-
constructor(pattern, options2 = {}) {
|
|
10610
|
+
constructor(pattern, options2 = {}, data) {
|
|
9142
10611
|
this.pattern = pattern;
|
|
9143
10612
|
this.separator = options2.separator || ".";
|
|
9144
10613
|
this.segments = this._parse(pattern);
|
|
10614
|
+
this.data = data;
|
|
9145
10615
|
this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
|
|
9146
10616
|
this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
|
|
9147
10617
|
this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
|
|
@@ -9292,30 +10762,302 @@ var Expression = class {
|
|
|
9292
10762
|
}
|
|
9293
10763
|
};
|
|
9294
10764
|
|
|
9295
|
-
// ../../.yarn/cache/path-expression-matcher-npm-1.
|
|
9296
|
-
var
|
|
10765
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/ExpressionSet.js
|
|
10766
|
+
var ExpressionSet = class {
|
|
10767
|
+
constructor() {
|
|
10768
|
+
this._byDepthAndTag = /* @__PURE__ */ new Map();
|
|
10769
|
+
this._wildcardByDepth = /* @__PURE__ */ new Map();
|
|
10770
|
+
this._deepWildcards = [];
|
|
10771
|
+
this._patterns = /* @__PURE__ */ new Set();
|
|
10772
|
+
this._sealed = false;
|
|
10773
|
+
}
|
|
10774
|
+
/**
|
|
10775
|
+
* Add an Expression to the set.
|
|
10776
|
+
* Duplicate patterns (same pattern string) are silently ignored.
|
|
10777
|
+
*
|
|
10778
|
+
* @param {import('./Expression.js').default} expression - A pre-constructed Expression instance
|
|
10779
|
+
* @returns {this} for chaining
|
|
10780
|
+
* @throws {TypeError} if called after seal()
|
|
10781
|
+
*
|
|
10782
|
+
* @example
|
|
10783
|
+
* set.add(new Expression('root.users.user'));
|
|
10784
|
+
* set.add(new Expression('..script'));
|
|
10785
|
+
*/
|
|
10786
|
+
add(expression) {
|
|
10787
|
+
if (this._sealed) {
|
|
10788
|
+
throw new TypeError(
|
|
10789
|
+
"ExpressionSet is sealed. Create a new ExpressionSet to add more expressions."
|
|
10790
|
+
);
|
|
10791
|
+
}
|
|
10792
|
+
if (this._patterns.has(expression.pattern)) return this;
|
|
10793
|
+
this._patterns.add(expression.pattern);
|
|
10794
|
+
if (expression.hasDeepWildcard()) {
|
|
10795
|
+
this._deepWildcards.push(expression);
|
|
10796
|
+
return this;
|
|
10797
|
+
}
|
|
10798
|
+
const depth = expression.length;
|
|
10799
|
+
const lastSeg = expression.segments[expression.segments.length - 1];
|
|
10800
|
+
const tag = lastSeg?.tag;
|
|
10801
|
+
if (!tag || tag === "*") {
|
|
10802
|
+
if (!this._wildcardByDepth.has(depth)) this._wildcardByDepth.set(depth, []);
|
|
10803
|
+
this._wildcardByDepth.get(depth).push(expression);
|
|
10804
|
+
} else {
|
|
10805
|
+
const key = `${depth}:${tag}`;
|
|
10806
|
+
if (!this._byDepthAndTag.has(key)) this._byDepthAndTag.set(key, []);
|
|
10807
|
+
this._byDepthAndTag.get(key).push(expression);
|
|
10808
|
+
}
|
|
10809
|
+
return this;
|
|
10810
|
+
}
|
|
10811
|
+
/**
|
|
10812
|
+
* Add multiple expressions at once.
|
|
10813
|
+
*
|
|
10814
|
+
* @param {import('./Expression.js').default[]} expressions - Array of Expression instances
|
|
10815
|
+
* @returns {this} for chaining
|
|
10816
|
+
*
|
|
10817
|
+
* @example
|
|
10818
|
+
* set.addAll([
|
|
10819
|
+
* new Expression('root.users.user'),
|
|
10820
|
+
* new Expression('root.config.setting'),
|
|
10821
|
+
* ]);
|
|
10822
|
+
*/
|
|
10823
|
+
addAll(expressions) {
|
|
10824
|
+
for (const expr of expressions) this.add(expr);
|
|
10825
|
+
return this;
|
|
10826
|
+
}
|
|
10827
|
+
/**
|
|
10828
|
+
* Check whether a pattern string is already present in the set.
|
|
10829
|
+
*
|
|
10830
|
+
* @param {import('./Expression.js').default} expression
|
|
10831
|
+
* @returns {boolean}
|
|
10832
|
+
*/
|
|
10833
|
+
has(expression) {
|
|
10834
|
+
return this._patterns.has(expression.pattern);
|
|
10835
|
+
}
|
|
10836
|
+
/**
|
|
10837
|
+
* Number of expressions in the set.
|
|
10838
|
+
* @type {number}
|
|
10839
|
+
*/
|
|
10840
|
+
get size() {
|
|
10841
|
+
return this._patterns.size;
|
|
10842
|
+
}
|
|
10843
|
+
/**
|
|
10844
|
+
* Seal the set against further modifications.
|
|
10845
|
+
* Useful to prevent accidental mutations after config is built.
|
|
10846
|
+
* Calling add() or addAll() on a sealed set throws a TypeError.
|
|
10847
|
+
*
|
|
10848
|
+
* @returns {this}
|
|
10849
|
+
*/
|
|
10850
|
+
seal() {
|
|
10851
|
+
this._sealed = true;
|
|
10852
|
+
return this;
|
|
10853
|
+
}
|
|
10854
|
+
/**
|
|
10855
|
+
* Whether the set has been sealed.
|
|
10856
|
+
* @type {boolean}
|
|
10857
|
+
*/
|
|
10858
|
+
get isSealed() {
|
|
10859
|
+
return this._sealed;
|
|
10860
|
+
}
|
|
10861
|
+
/**
|
|
10862
|
+
* Test whether the matcher's current path matches any expression in the set.
|
|
10863
|
+
*
|
|
10864
|
+
* Evaluation order (cheapest → most expensive):
|
|
10865
|
+
* 1. Exact depth + tag bucket — O(1) lookup, typically 0–2 expressions
|
|
10866
|
+
* 2. Depth-only wildcard bucket — O(1) lookup, rare
|
|
10867
|
+
* 3. Deep-wildcard list — always checked, but usually small
|
|
10868
|
+
*
|
|
10869
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
10870
|
+
* @returns {boolean} true if any expression matches the current path
|
|
10871
|
+
*
|
|
10872
|
+
* @example
|
|
10873
|
+
* if (stopNodes.matchesAny(matcher)) {
|
|
10874
|
+
* // handle stop node
|
|
10875
|
+
* }
|
|
10876
|
+
*/
|
|
10877
|
+
matchesAny(matcher) {
|
|
10878
|
+
return this.findMatch(matcher) !== null;
|
|
10879
|
+
}
|
|
10880
|
+
/**
|
|
10881
|
+
* Find and return the first Expression that matches the matcher's current path.
|
|
10882
|
+
*
|
|
10883
|
+
* Uses the same evaluation order as matchesAny (cheapest → most expensive):
|
|
10884
|
+
* 1. Exact depth + tag bucket
|
|
10885
|
+
* 2. Depth-only wildcard bucket
|
|
10886
|
+
* 3. Deep-wildcard list
|
|
10887
|
+
*
|
|
10888
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
10889
|
+
* @returns {import('./Expression.js').default | null} the first matching Expression, or null
|
|
10890
|
+
*
|
|
10891
|
+
* @example
|
|
10892
|
+
* const expr = stopNodes.findMatch(matcher);
|
|
10893
|
+
* if (expr) {
|
|
10894
|
+
* // access expr.config, expr.pattern, etc.
|
|
10895
|
+
* }
|
|
10896
|
+
*/
|
|
10897
|
+
findMatch(matcher) {
|
|
10898
|
+
const depth = matcher.getDepth();
|
|
10899
|
+
const tag = matcher.getCurrentTag();
|
|
10900
|
+
const exactKey = `${depth}:${tag}`;
|
|
10901
|
+
const exactBucket = this._byDepthAndTag.get(exactKey);
|
|
10902
|
+
if (exactBucket) {
|
|
10903
|
+
for (let i = 0; i < exactBucket.length; i++) {
|
|
10904
|
+
if (matcher.matches(exactBucket[i])) return exactBucket[i];
|
|
10905
|
+
}
|
|
10906
|
+
}
|
|
10907
|
+
const wildcardBucket = this._wildcardByDepth.get(depth);
|
|
10908
|
+
if (wildcardBucket) {
|
|
10909
|
+
for (let i = 0; i < wildcardBucket.length; i++) {
|
|
10910
|
+
if (matcher.matches(wildcardBucket[i])) return wildcardBucket[i];
|
|
10911
|
+
}
|
|
10912
|
+
}
|
|
10913
|
+
for (let i = 0; i < this._deepWildcards.length; i++) {
|
|
10914
|
+
if (matcher.matches(this._deepWildcards[i])) return this._deepWildcards[i];
|
|
10915
|
+
}
|
|
10916
|
+
return null;
|
|
10917
|
+
}
|
|
10918
|
+
};
|
|
10919
|
+
|
|
10920
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/Matcher.js
|
|
10921
|
+
var MatcherView = class {
|
|
10922
|
+
/**
|
|
10923
|
+
* @param {Matcher} matcher - The parent Matcher instance to read from.
|
|
10924
|
+
*/
|
|
10925
|
+
constructor(matcher) {
|
|
10926
|
+
this._matcher = matcher;
|
|
10927
|
+
}
|
|
10928
|
+
/**
|
|
10929
|
+
* Get the path separator used by the parent matcher.
|
|
10930
|
+
* @returns {string}
|
|
10931
|
+
*/
|
|
10932
|
+
get separator() {
|
|
10933
|
+
return this._matcher.separator;
|
|
10934
|
+
}
|
|
10935
|
+
/**
|
|
10936
|
+
* Get current tag name.
|
|
10937
|
+
* @returns {string|undefined}
|
|
10938
|
+
*/
|
|
10939
|
+
getCurrentTag() {
|
|
10940
|
+
const path = this._matcher.path;
|
|
10941
|
+
return path.length > 0 ? path[path.length - 1].tag : void 0;
|
|
10942
|
+
}
|
|
10943
|
+
/**
|
|
10944
|
+
* Get current namespace.
|
|
10945
|
+
* @returns {string|undefined}
|
|
10946
|
+
*/
|
|
10947
|
+
getCurrentNamespace() {
|
|
10948
|
+
const path = this._matcher.path;
|
|
10949
|
+
return path.length > 0 ? path[path.length - 1].namespace : void 0;
|
|
10950
|
+
}
|
|
10951
|
+
/**
|
|
10952
|
+
* Get current node's attribute value.
|
|
10953
|
+
* @param {string} attrName
|
|
10954
|
+
* @returns {*}
|
|
10955
|
+
*/
|
|
10956
|
+
getAttrValue(attrName) {
|
|
10957
|
+
const path = this._matcher.path;
|
|
10958
|
+
if (path.length === 0) return void 0;
|
|
10959
|
+
return path[path.length - 1].values?.[attrName];
|
|
10960
|
+
}
|
|
10961
|
+
/**
|
|
10962
|
+
* Check if current node has an attribute.
|
|
10963
|
+
* @param {string} attrName
|
|
10964
|
+
* @returns {boolean}
|
|
10965
|
+
*/
|
|
10966
|
+
hasAttr(attrName) {
|
|
10967
|
+
const path = this._matcher.path;
|
|
10968
|
+
if (path.length === 0) return false;
|
|
10969
|
+
const current = path[path.length - 1];
|
|
10970
|
+
return current.values !== void 0 && attrName in current.values;
|
|
10971
|
+
}
|
|
10972
|
+
/**
|
|
10973
|
+
* Get current node's sibling position (child index in parent).
|
|
10974
|
+
* @returns {number}
|
|
10975
|
+
*/
|
|
10976
|
+
getPosition() {
|
|
10977
|
+
const path = this._matcher.path;
|
|
10978
|
+
if (path.length === 0) return -1;
|
|
10979
|
+
return path[path.length - 1].position ?? 0;
|
|
10980
|
+
}
|
|
10981
|
+
/**
|
|
10982
|
+
* Get current node's repeat counter (occurrence count of this tag name).
|
|
10983
|
+
* @returns {number}
|
|
10984
|
+
*/
|
|
10985
|
+
getCounter() {
|
|
10986
|
+
const path = this._matcher.path;
|
|
10987
|
+
if (path.length === 0) return -1;
|
|
10988
|
+
return path[path.length - 1].counter ?? 0;
|
|
10989
|
+
}
|
|
10990
|
+
/**
|
|
10991
|
+
* Get current node's sibling index (alias for getPosition).
|
|
10992
|
+
* @returns {number}
|
|
10993
|
+
* @deprecated Use getPosition() or getCounter() instead
|
|
10994
|
+
*/
|
|
10995
|
+
getIndex() {
|
|
10996
|
+
return this.getPosition();
|
|
10997
|
+
}
|
|
10998
|
+
/**
|
|
10999
|
+
* Get current path depth.
|
|
11000
|
+
* @returns {number}
|
|
11001
|
+
*/
|
|
11002
|
+
getDepth() {
|
|
11003
|
+
return this._matcher.path.length;
|
|
11004
|
+
}
|
|
11005
|
+
/**
|
|
11006
|
+
* Get path as string.
|
|
11007
|
+
* @param {string} [separator] - Optional separator (uses default if not provided)
|
|
11008
|
+
* @param {boolean} [includeNamespace=true]
|
|
11009
|
+
* @returns {string}
|
|
11010
|
+
*/
|
|
11011
|
+
toString(separator, includeNamespace = true) {
|
|
11012
|
+
return this._matcher.toString(separator, includeNamespace);
|
|
11013
|
+
}
|
|
11014
|
+
/**
|
|
11015
|
+
* Get path as array of tag names.
|
|
11016
|
+
* @returns {string[]}
|
|
11017
|
+
*/
|
|
11018
|
+
toArray() {
|
|
11019
|
+
return this._matcher.path.map((n) => n.tag);
|
|
11020
|
+
}
|
|
11021
|
+
/**
|
|
11022
|
+
* Match current path against an Expression.
|
|
11023
|
+
* @param {Expression} expression
|
|
11024
|
+
* @returns {boolean}
|
|
11025
|
+
*/
|
|
11026
|
+
matches(expression) {
|
|
11027
|
+
return this._matcher.matches(expression);
|
|
11028
|
+
}
|
|
11029
|
+
/**
|
|
11030
|
+
* Match any expression in the given set against the current path.
|
|
11031
|
+
* @param {ExpressionSet} exprSet
|
|
11032
|
+
* @returns {boolean}
|
|
11033
|
+
*/
|
|
11034
|
+
matchesAny(exprSet) {
|
|
11035
|
+
return exprSet.matchesAny(this._matcher);
|
|
11036
|
+
}
|
|
11037
|
+
};
|
|
9297
11038
|
var Matcher = class {
|
|
9298
11039
|
/**
|
|
9299
|
-
* Create a new Matcher
|
|
9300
|
-
* @param {Object} options
|
|
9301
|
-
* @param {string} options.separator - Default path separator
|
|
11040
|
+
* Create a new Matcher.
|
|
11041
|
+
* @param {Object} [options={}]
|
|
11042
|
+
* @param {string} [options.separator='.'] - Default path separator
|
|
9302
11043
|
*/
|
|
9303
11044
|
constructor(options2 = {}) {
|
|
9304
11045
|
this.separator = options2.separator || ".";
|
|
9305
11046
|
this.path = [];
|
|
9306
11047
|
this.siblingStacks = [];
|
|
11048
|
+
this._pathStringCache = null;
|
|
11049
|
+
this._view = new MatcherView(this);
|
|
9307
11050
|
}
|
|
9308
11051
|
/**
|
|
9309
|
-
* Push a new tag onto the path
|
|
9310
|
-
* @param {string} tagName
|
|
9311
|
-
* @param {Object} attrValues
|
|
9312
|
-
* @param {string} namespace
|
|
11052
|
+
* Push a new tag onto the path.
|
|
11053
|
+
* @param {string} tagName
|
|
11054
|
+
* @param {Object|null} [attrValues=null]
|
|
11055
|
+
* @param {string|null} [namespace=null]
|
|
9313
11056
|
*/
|
|
9314
11057
|
push(tagName, attrValues = null, namespace = null) {
|
|
9315
11058
|
this._pathStringCache = null;
|
|
9316
11059
|
if (this.path.length > 0) {
|
|
9317
|
-
|
|
9318
|
-
prev.values = void 0;
|
|
11060
|
+
this.path[this.path.length - 1].values = void 0;
|
|
9319
11061
|
}
|
|
9320
11062
|
const currentLevel = this.path.length;
|
|
9321
11063
|
if (!this.siblingStacks[currentLevel]) {
|
|
@@ -9343,13 +11085,11 @@ var Matcher = class {
|
|
|
9343
11085
|
this.path.push(node);
|
|
9344
11086
|
}
|
|
9345
11087
|
/**
|
|
9346
|
-
* Pop the last tag from the path
|
|
11088
|
+
* Pop the last tag from the path.
|
|
9347
11089
|
* @returns {Object|undefined} The popped node
|
|
9348
11090
|
*/
|
|
9349
11091
|
pop() {
|
|
9350
|
-
if (this.path.length === 0)
|
|
9351
|
-
return void 0;
|
|
9352
|
-
}
|
|
11092
|
+
if (this.path.length === 0) return void 0;
|
|
9353
11093
|
this._pathStringCache = null;
|
|
9354
11094
|
const node = this.path.pop();
|
|
9355
11095
|
if (this.siblingStacks.length > this.path.length + 1) {
|
|
@@ -9358,9 +11098,9 @@ var Matcher = class {
|
|
|
9358
11098
|
return node;
|
|
9359
11099
|
}
|
|
9360
11100
|
/**
|
|
9361
|
-
* Update current node's attribute values
|
|
9362
|
-
* Useful when attributes are parsed after push
|
|
9363
|
-
* @param {Object} attrValues
|
|
11101
|
+
* Update current node's attribute values.
|
|
11102
|
+
* Useful when attributes are parsed after push.
|
|
11103
|
+
* @param {Object} attrValues
|
|
9364
11104
|
*/
|
|
9365
11105
|
updateCurrent(attrValues) {
|
|
9366
11106
|
if (this.path.length > 0) {
|
|
@@ -9371,32 +11111,31 @@ var Matcher = class {
|
|
|
9371
11111
|
}
|
|
9372
11112
|
}
|
|
9373
11113
|
/**
|
|
9374
|
-
* Get current tag name
|
|
11114
|
+
* Get current tag name.
|
|
9375
11115
|
* @returns {string|undefined}
|
|
9376
11116
|
*/
|
|
9377
11117
|
getCurrentTag() {
|
|
9378
11118
|
return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
|
|
9379
11119
|
}
|
|
9380
11120
|
/**
|
|
9381
|
-
* Get current namespace
|
|
11121
|
+
* Get current namespace.
|
|
9382
11122
|
* @returns {string|undefined}
|
|
9383
11123
|
*/
|
|
9384
11124
|
getCurrentNamespace() {
|
|
9385
11125
|
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
|
|
9386
11126
|
}
|
|
9387
11127
|
/**
|
|
9388
|
-
* Get current node's attribute value
|
|
9389
|
-
* @param {string} attrName
|
|
9390
|
-
* @returns {*}
|
|
11128
|
+
* Get current node's attribute value.
|
|
11129
|
+
* @param {string} attrName
|
|
11130
|
+
* @returns {*}
|
|
9391
11131
|
*/
|
|
9392
11132
|
getAttrValue(attrName) {
|
|
9393
11133
|
if (this.path.length === 0) return void 0;
|
|
9394
|
-
|
|
9395
|
-
return current.values?.[attrName];
|
|
11134
|
+
return this.path[this.path.length - 1].values?.[attrName];
|
|
9396
11135
|
}
|
|
9397
11136
|
/**
|
|
9398
|
-
* Check if current node has an attribute
|
|
9399
|
-
* @param {string} attrName
|
|
11137
|
+
* Check if current node has an attribute.
|
|
11138
|
+
* @param {string} attrName
|
|
9400
11139
|
* @returns {boolean}
|
|
9401
11140
|
*/
|
|
9402
11141
|
hasAttr(attrName) {
|
|
@@ -9405,7 +11144,7 @@ var Matcher = class {
|
|
|
9405
11144
|
return current.values !== void 0 && attrName in current.values;
|
|
9406
11145
|
}
|
|
9407
11146
|
/**
|
|
9408
|
-
* Get current node's sibling position (child index in parent)
|
|
11147
|
+
* Get current node's sibling position (child index in parent).
|
|
9409
11148
|
* @returns {number}
|
|
9410
11149
|
*/
|
|
9411
11150
|
getPosition() {
|
|
@@ -9413,7 +11152,7 @@ var Matcher = class {
|
|
|
9413
11152
|
return this.path[this.path.length - 1].position ?? 0;
|
|
9414
11153
|
}
|
|
9415
11154
|
/**
|
|
9416
|
-
* Get current node's repeat counter (occurrence count of this tag name)
|
|
11155
|
+
* Get current node's repeat counter (occurrence count of this tag name).
|
|
9417
11156
|
* @returns {number}
|
|
9418
11157
|
*/
|
|
9419
11158
|
getCounter() {
|
|
@@ -9421,7 +11160,7 @@ var Matcher = class {
|
|
|
9421
11160
|
return this.path[this.path.length - 1].counter ?? 0;
|
|
9422
11161
|
}
|
|
9423
11162
|
/**
|
|
9424
|
-
* Get current node's sibling index (alias for getPosition
|
|
11163
|
+
* Get current node's sibling index (alias for getPosition).
|
|
9425
11164
|
* @returns {number}
|
|
9426
11165
|
* @deprecated Use getPosition() or getCounter() instead
|
|
9427
11166
|
*/
|
|
@@ -9429,27 +11168,27 @@ var Matcher = class {
|
|
|
9429
11168
|
return this.getPosition();
|
|
9430
11169
|
}
|
|
9431
11170
|
/**
|
|
9432
|
-
* Get current path depth
|
|
11171
|
+
* Get current path depth.
|
|
9433
11172
|
* @returns {number}
|
|
9434
11173
|
*/
|
|
9435
11174
|
getDepth() {
|
|
9436
11175
|
return this.path.length;
|
|
9437
11176
|
}
|
|
9438
11177
|
/**
|
|
9439
|
-
* Get path as string
|
|
9440
|
-
* @param {string} separator - Optional separator (uses default if not provided)
|
|
9441
|
-
* @param {boolean} includeNamespace
|
|
11178
|
+
* Get path as string.
|
|
11179
|
+
* @param {string} [separator] - Optional separator (uses default if not provided)
|
|
11180
|
+
* @param {boolean} [includeNamespace=true]
|
|
9442
11181
|
* @returns {string}
|
|
9443
11182
|
*/
|
|
9444
11183
|
toString(separator, includeNamespace = true) {
|
|
9445
11184
|
const sep = separator || this.separator;
|
|
9446
11185
|
const isDefault = sep === this.separator && includeNamespace === true;
|
|
9447
11186
|
if (isDefault) {
|
|
9448
|
-
if (this._pathStringCache !== null
|
|
11187
|
+
if (this._pathStringCache !== null) {
|
|
9449
11188
|
return this._pathStringCache;
|
|
9450
11189
|
}
|
|
9451
11190
|
const result = this.path.map(
|
|
9452
|
-
(n) =>
|
|
11191
|
+
(n) => n.namespace ? `${n.namespace}:${n.tag}` : n.tag
|
|
9453
11192
|
).join(sep);
|
|
9454
11193
|
this._pathStringCache = result;
|
|
9455
11194
|
return result;
|
|
@@ -9459,14 +11198,14 @@ var Matcher = class {
|
|
|
9459
11198
|
).join(sep);
|
|
9460
11199
|
}
|
|
9461
11200
|
/**
|
|
9462
|
-
* Get path as array of tag names
|
|
11201
|
+
* Get path as array of tag names.
|
|
9463
11202
|
* @returns {string[]}
|
|
9464
11203
|
*/
|
|
9465
11204
|
toArray() {
|
|
9466
11205
|
return this.path.map((n) => n.tag);
|
|
9467
11206
|
}
|
|
9468
11207
|
/**
|
|
9469
|
-
* Reset the path to empty
|
|
11208
|
+
* Reset the path to empty.
|
|
9470
11209
|
*/
|
|
9471
11210
|
reset() {
|
|
9472
11211
|
this._pathStringCache = null;
|
|
@@ -9474,9 +11213,9 @@ var Matcher = class {
|
|
|
9474
11213
|
this.siblingStacks = [];
|
|
9475
11214
|
}
|
|
9476
11215
|
/**
|
|
9477
|
-
* Match current path against an Expression
|
|
9478
|
-
* @param {Expression} expression
|
|
9479
|
-
* @returns {boolean}
|
|
11216
|
+
* Match current path against an Expression.
|
|
11217
|
+
* @param {Expression} expression
|
|
11218
|
+
* @returns {boolean}
|
|
9480
11219
|
*/
|
|
9481
11220
|
matches(expression) {
|
|
9482
11221
|
const segments = expression.segments;
|
|
@@ -9489,7 +11228,6 @@ var Matcher = class {
|
|
|
9489
11228
|
return this._matchSimple(segments);
|
|
9490
11229
|
}
|
|
9491
11230
|
/**
|
|
9492
|
-
* Match simple path (no deep wildcards)
|
|
9493
11231
|
* @private
|
|
9494
11232
|
*/
|
|
9495
11233
|
_matchSimple(segments) {
|
|
@@ -9497,17 +11235,13 @@ var Matcher = class {
|
|
|
9497
11235
|
return false;
|
|
9498
11236
|
}
|
|
9499
11237
|
for (let i = 0; i < segments.length; i++) {
|
|
9500
|
-
|
|
9501
|
-
const node = this.path[i];
|
|
9502
|
-
const isCurrentNode = i === this.path.length - 1;
|
|
9503
|
-
if (!this._matchSegment(segment, node, isCurrentNode)) {
|
|
11238
|
+
if (!this._matchSegment(segments[i], this.path[i], i === this.path.length - 1)) {
|
|
9504
11239
|
return false;
|
|
9505
11240
|
}
|
|
9506
11241
|
}
|
|
9507
11242
|
return true;
|
|
9508
11243
|
}
|
|
9509
11244
|
/**
|
|
9510
|
-
* Match path with deep wildcards
|
|
9511
11245
|
* @private
|
|
9512
11246
|
*/
|
|
9513
11247
|
_matchWithDeepWildcard(segments) {
|
|
@@ -9523,8 +11257,7 @@ var Matcher = class {
|
|
|
9523
11257
|
const nextSeg = segments[segIdx];
|
|
9524
11258
|
let found = false;
|
|
9525
11259
|
for (let i = pathIdx; i >= 0; i--) {
|
|
9526
|
-
|
|
9527
|
-
if (this._matchSegment(nextSeg, this.path[i], isCurrentNode)) {
|
|
11260
|
+
if (this._matchSegment(nextSeg, this.path[i], i === this.path.length - 1)) {
|
|
9528
11261
|
pathIdx = i - 1;
|
|
9529
11262
|
segIdx--;
|
|
9530
11263
|
found = true;
|
|
@@ -9535,8 +11268,7 @@ var Matcher = class {
|
|
|
9535
11268
|
return false;
|
|
9536
11269
|
}
|
|
9537
11270
|
} else {
|
|
9538
|
-
|
|
9539
|
-
if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
|
|
11271
|
+
if (!this._matchSegment(segment, this.path[pathIdx], pathIdx === this.path.length - 1)) {
|
|
9540
11272
|
return false;
|
|
9541
11273
|
}
|
|
9542
11274
|
pathIdx--;
|
|
@@ -9546,12 +11278,7 @@ var Matcher = class {
|
|
|
9546
11278
|
return segIdx < 0;
|
|
9547
11279
|
}
|
|
9548
11280
|
/**
|
|
9549
|
-
* Match a single segment against a node
|
|
9550
11281
|
* @private
|
|
9551
|
-
* @param {Object} segment - Segment from Expression
|
|
9552
|
-
* @param {Object} node - Node from path
|
|
9553
|
-
* @param {boolean} isCurrentNode - Whether this is the current (last) node
|
|
9554
|
-
* @returns {boolean}
|
|
9555
11282
|
*/
|
|
9556
11283
|
_matchSegment(segment, node, isCurrentNode) {
|
|
9557
11284
|
if (segment.tag !== "*" && segment.tag !== node.tag) {
|
|
@@ -9570,8 +11297,7 @@ var Matcher = class {
|
|
|
9570
11297
|
return false;
|
|
9571
11298
|
}
|
|
9572
11299
|
if (segment.attrValue !== void 0) {
|
|
9573
|
-
|
|
9574
|
-
if (String(actualValue) !== String(segment.attrValue)) {
|
|
11300
|
+
if (String(node.values[segment.attrName]) !== String(segment.attrValue)) {
|
|
9575
11301
|
return false;
|
|
9576
11302
|
}
|
|
9577
11303
|
}
|
|
@@ -9587,17 +11313,23 @@ var Matcher = class {
|
|
|
9587
11313
|
return false;
|
|
9588
11314
|
} else if (segment.position === "even" && counter % 2 !== 0) {
|
|
9589
11315
|
return false;
|
|
9590
|
-
} else if (segment.position === "nth") {
|
|
9591
|
-
|
|
9592
|
-
return false;
|
|
9593
|
-
}
|
|
11316
|
+
} else if (segment.position === "nth" && counter !== segment.positionValue) {
|
|
11317
|
+
return false;
|
|
9594
11318
|
}
|
|
9595
11319
|
}
|
|
9596
11320
|
return true;
|
|
9597
11321
|
}
|
|
9598
11322
|
/**
|
|
9599
|
-
*
|
|
9600
|
-
* @
|
|
11323
|
+
* Match any expression in the given set against the current path.
|
|
11324
|
+
* @param {ExpressionSet} exprSet
|
|
11325
|
+
* @returns {boolean}
|
|
11326
|
+
*/
|
|
11327
|
+
matchesAny(exprSet) {
|
|
11328
|
+
return exprSet.matchesAny(this);
|
|
11329
|
+
}
|
|
11330
|
+
/**
|
|
11331
|
+
* Create a snapshot of current state.
|
|
11332
|
+
* @returns {Object}
|
|
9601
11333
|
*/
|
|
9602
11334
|
snapshot() {
|
|
9603
11335
|
return {
|
|
@@ -9606,8 +11338,8 @@ var Matcher = class {
|
|
|
9606
11338
|
};
|
|
9607
11339
|
}
|
|
9608
11340
|
/**
|
|
9609
|
-
* Restore state from snapshot
|
|
9610
|
-
* @param {Object} snapshot
|
|
11341
|
+
* Restore state from snapshot.
|
|
11342
|
+
* @param {Object} snapshot
|
|
9611
11343
|
*/
|
|
9612
11344
|
restore(snapshot) {
|
|
9613
11345
|
this._pathStringCache = null;
|
|
@@ -9615,68 +11347,27 @@ var Matcher = class {
|
|
|
9615
11347
|
this.siblingStacks = snapshot.siblingStacks.map((map2) => new Map(map2));
|
|
9616
11348
|
}
|
|
9617
11349
|
/**
|
|
9618
|
-
* Return
|
|
11350
|
+
* Return the read-only {@link MatcherView} for this matcher.
|
|
9619
11351
|
*
|
|
9620
|
-
* The returned
|
|
9621
|
-
*
|
|
9622
|
-
*
|
|
9623
|
-
* are allowed but the returned arrays/objects are frozen so callers cannot
|
|
9624
|
-
* mutate internal state through them either.
|
|
11352
|
+
* The same instance is returned on every call — no allocation occurs.
|
|
11353
|
+
* It always reflects the current parser state and is safe to pass to
|
|
11354
|
+
* user callbacks without risk of accidental mutation.
|
|
9625
11355
|
*
|
|
9626
|
-
* @returns {
|
|
11356
|
+
* @returns {MatcherView}
|
|
9627
11357
|
*
|
|
9628
11358
|
* @example
|
|
9629
|
-
* const
|
|
9630
|
-
*
|
|
9631
|
-
*
|
|
9632
|
-
*
|
|
9633
|
-
*
|
|
9634
|
-
* ro.getCurrentTag(); // ✓ works
|
|
9635
|
-
* ro.push("child", {}); // ✗ throws TypeError
|
|
9636
|
-
* ro.reset(); // ✗ throws TypeError
|
|
11359
|
+
* const view = matcher.readOnly();
|
|
11360
|
+
* // pass view to callbacks — it stays in sync automatically
|
|
11361
|
+
* view.matches(expr); // ✓
|
|
11362
|
+
* view.getCurrentTag(); // ✓
|
|
11363
|
+
* // view.push(...) // ✗ method does not exist — caught by TypeScript
|
|
9637
11364
|
*/
|
|
9638
11365
|
readOnly() {
|
|
9639
|
-
|
|
9640
|
-
return new Proxy(self2, {
|
|
9641
|
-
get(target, prop, receiver) {
|
|
9642
|
-
if (MUTATING_METHODS.has(prop)) {
|
|
9643
|
-
return () => {
|
|
9644
|
-
throw new TypeError(
|
|
9645
|
-
`Cannot call '${prop}' on a read-only Matcher. Obtain a writable instance to mutate state.`
|
|
9646
|
-
);
|
|
9647
|
-
};
|
|
9648
|
-
}
|
|
9649
|
-
const value = Reflect.get(target, prop, receiver);
|
|
9650
|
-
if (prop === "path" || prop === "siblingStacks") {
|
|
9651
|
-
return Object.freeze(
|
|
9652
|
-
Array.isArray(value) ? value.map(
|
|
9653
|
-
(item) => item instanceof Map ? Object.freeze(new Map(item)) : Object.freeze({ ...item })
|
|
9654
|
-
// freeze a copy of each node
|
|
9655
|
-
) : value
|
|
9656
|
-
);
|
|
9657
|
-
}
|
|
9658
|
-
if (typeof value === "function") {
|
|
9659
|
-
return value.bind(target);
|
|
9660
|
-
}
|
|
9661
|
-
return value;
|
|
9662
|
-
},
|
|
9663
|
-
// Prevent any property assignment on the read-only view
|
|
9664
|
-
set(_target, prop) {
|
|
9665
|
-
throw new TypeError(
|
|
9666
|
-
`Cannot set property '${String(prop)}' on a read-only Matcher.`
|
|
9667
|
-
);
|
|
9668
|
-
},
|
|
9669
|
-
// Prevent property deletion
|
|
9670
|
-
deleteProperty(_target, prop) {
|
|
9671
|
-
throw new TypeError(
|
|
9672
|
-
`Cannot delete property '${String(prop)}' from a read-only Matcher.`
|
|
9673
|
-
);
|
|
9674
|
-
}
|
|
9675
|
-
});
|
|
11366
|
+
return this._view;
|
|
9676
11367
|
}
|
|
9677
11368
|
};
|
|
9678
11369
|
|
|
9679
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
11370
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
9680
11371
|
function extractRawAttributes(prefixedAttrs, options2) {
|
|
9681
11372
|
if (!prefixedAttrs) return {};
|
|
9682
11373
|
const attrs = options2.attributesGroupName ? prefixedAttrs[options2.attributesGroupName] : prefixedAttrs;
|
|
@@ -9704,36 +11395,10 @@ function extractNamespace(rawTagName) {
|
|
|
9704
11395
|
return void 0;
|
|
9705
11396
|
}
|
|
9706
11397
|
var OrderedObjParser = class {
|
|
9707
|
-
constructor(options2) {
|
|
11398
|
+
constructor(options2, externalEntities) {
|
|
9708
11399
|
this.options = options2;
|
|
9709
11400
|
this.currentNode = null;
|
|
9710
11401
|
this.tagsNodeStack = [];
|
|
9711
|
-
this.docTypeEntities = {};
|
|
9712
|
-
this.lastEntities = {
|
|
9713
|
-
"apos": { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
9714
|
-
"gt": { regex: /&(gt|#62|#x3E);/g, val: ">" },
|
|
9715
|
-
"lt": { regex: /&(lt|#60|#x3C);/g, val: "<" },
|
|
9716
|
-
"quot": { regex: /&(quot|#34|#x22);/g, val: '"' }
|
|
9717
|
-
};
|
|
9718
|
-
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" };
|
|
9719
|
-
this.htmlEntities = {
|
|
9720
|
-
"space": { regex: /&(nbsp|#160);/g, val: " " },
|
|
9721
|
-
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
9722
|
-
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
9723
|
-
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
9724
|
-
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
9725
|
-
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
9726
|
-
"cent": { regex: /&(cent|#162);/g, val: "\xA2" },
|
|
9727
|
-
"pound": { regex: /&(pound|#163);/g, val: "\xA3" },
|
|
9728
|
-
"yen": { regex: /&(yen|#165);/g, val: "\xA5" },
|
|
9729
|
-
"euro": { regex: /&(euro|#8364);/g, val: "\u20AC" },
|
|
9730
|
-
"copyright": { regex: /&(copy|#169);/g, val: "\xA9" },
|
|
9731
|
-
"reg": { regex: /&(reg|#174);/g, val: "\xAE" },
|
|
9732
|
-
"inr": { regex: /&(inr|#8377);/g, val: "\u20B9" },
|
|
9733
|
-
"num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => fromCodePoint(str, 10, "&#") },
|
|
9734
|
-
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => fromCodePoint(str, 16, "&#x") }
|
|
9735
|
-
};
|
|
9736
|
-
this.addExternalEntities = addExternalEntities;
|
|
9737
11402
|
this.parseXml = parseXml;
|
|
9738
11403
|
this.parseTextData = parseTextData;
|
|
9739
11404
|
this.resolveNameSpace = resolveNameSpace;
|
|
@@ -9746,52 +11411,61 @@ var OrderedObjParser = class {
|
|
|
9746
11411
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
9747
11412
|
this.entityExpansionCount = 0;
|
|
9748
11413
|
this.currentExpandedLength = 0;
|
|
11414
|
+
let namedEntities = { ...XML };
|
|
11415
|
+
if (this.options.entityDecoder) {
|
|
11416
|
+
this.entityDecoder = this.options.entityDecoder;
|
|
11417
|
+
} else {
|
|
11418
|
+
if (typeof this.options.htmlEntities === "object") namedEntities = this.options.htmlEntities;
|
|
11419
|
+
else if (this.options.htmlEntities === true) namedEntities = { ...COMMON_HTML, ...CURRENCY };
|
|
11420
|
+
this.entityDecoder = new EntityDecoder({
|
|
11421
|
+
namedEntities: { ...namedEntities, ...externalEntities },
|
|
11422
|
+
numericAllowed: this.options.htmlEntities,
|
|
11423
|
+
limit: {
|
|
11424
|
+
maxTotalExpansions: this.options.processEntities.maxTotalExpansions,
|
|
11425
|
+
maxExpandedLength: this.options.processEntities.maxExpandedLength,
|
|
11426
|
+
applyLimitsTo: this.options.processEntities.appliesTo
|
|
11427
|
+
}
|
|
11428
|
+
//postCheck: resolved => resolved
|
|
11429
|
+
});
|
|
11430
|
+
}
|
|
9749
11431
|
this.matcher = new Matcher();
|
|
9750
11432
|
this.readonlyMatcher = this.matcher.readOnly();
|
|
9751
11433
|
this.isCurrentNodeStopNode = false;
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
11434
|
+
this.stopNodeExpressionsSet = new ExpressionSet();
|
|
11435
|
+
const stopNodesOpts = this.options.stopNodes;
|
|
11436
|
+
if (stopNodesOpts && stopNodesOpts.length > 0) {
|
|
11437
|
+
for (let i = 0; i < stopNodesOpts.length; i++) {
|
|
11438
|
+
const stopNodeExp = stopNodesOpts[i];
|
|
9756
11439
|
if (typeof stopNodeExp === "string") {
|
|
9757
|
-
this.
|
|
11440
|
+
this.stopNodeExpressionsSet.add(new Expression(stopNodeExp));
|
|
9758
11441
|
} else if (stopNodeExp instanceof Expression) {
|
|
9759
|
-
this.
|
|
11442
|
+
this.stopNodeExpressionsSet.add(stopNodeExp);
|
|
9760
11443
|
}
|
|
9761
11444
|
}
|
|
11445
|
+
this.stopNodeExpressionsSet.seal();
|
|
9762
11446
|
}
|
|
9763
11447
|
}
|
|
9764
11448
|
};
|
|
9765
|
-
function addExternalEntities(externalEntities) {
|
|
9766
|
-
const entKeys = Object.keys(externalEntities);
|
|
9767
|
-
for (let i = 0; i < entKeys.length; i++) {
|
|
9768
|
-
const ent = entKeys[i];
|
|
9769
|
-
const escaped = ent.replace(/[.\-+*:]/g, "\\.");
|
|
9770
|
-
this.lastEntities[ent] = {
|
|
9771
|
-
regex: new RegExp("&" + escaped + ";", "g"),
|
|
9772
|
-
val: externalEntities[ent]
|
|
9773
|
-
};
|
|
9774
|
-
}
|
|
9775
|
-
}
|
|
9776
11449
|
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
11450
|
+
const options2 = this.options;
|
|
9777
11451
|
if (val !== void 0) {
|
|
9778
|
-
if (
|
|
11452
|
+
if (options2.trimValues && !dontTrim) {
|
|
9779
11453
|
val = val.trim();
|
|
9780
11454
|
}
|
|
9781
11455
|
if (val.length > 0) {
|
|
9782
11456
|
if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
|
|
9783
|
-
const jPathOrMatcher =
|
|
9784
|
-
const newval =
|
|
11457
|
+
const jPathOrMatcher = options2.jPath ? jPath.toString() : jPath;
|
|
11458
|
+
const newval = options2.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
|
|
9785
11459
|
if (newval === null || newval === void 0) {
|
|
9786
11460
|
return val;
|
|
9787
11461
|
} else if (typeof newval !== typeof val || newval !== val) {
|
|
9788
11462
|
return newval;
|
|
9789
|
-
} else if (
|
|
9790
|
-
return parseValue(val,
|
|
11463
|
+
} else if (options2.trimValues) {
|
|
11464
|
+
return parseValue(val, options2.parseTagValue, options2.numberParseOptions);
|
|
9791
11465
|
} else {
|
|
9792
11466
|
const trimmedVal = val.trim();
|
|
9793
11467
|
if (trimmedVal === val) {
|
|
9794
|
-
return parseValue(val,
|
|
11468
|
+
return parseValue(val, options2.parseTagValue, options2.numberParseOptions);
|
|
9795
11469
|
} else {
|
|
9796
11470
|
return val;
|
|
9797
11471
|
}
|
|
@@ -9813,8 +11487,9 @@ function resolveNameSpace(tagname) {
|
|
|
9813
11487
|
return tagname;
|
|
9814
11488
|
}
|
|
9815
11489
|
var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
9816
|
-
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
9817
|
-
|
|
11490
|
+
function buildAttributesMap(attrStr, jPath, tagName, force = false) {
|
|
11491
|
+
const options2 = this.options;
|
|
11492
|
+
if (force === true || options2.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
9818
11493
|
const matches = getAllMatches(attrStr, attrsRegx);
|
|
9819
11494
|
const len = matches.length;
|
|
9820
11495
|
const attrs = {};
|
|
@@ -9826,7 +11501,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
9826
11501
|
const oldVal = matches[i][4];
|
|
9827
11502
|
if (attrName.length && oldVal !== void 0) {
|
|
9828
11503
|
let val = oldVal;
|
|
9829
|
-
if (
|
|
11504
|
+
if (options2.trimValues) val = val.trim();
|
|
9830
11505
|
val = this.replaceEntitiesValue(val, tagName, this.readonlyMatcher);
|
|
9831
11506
|
processedVals[i] = val;
|
|
9832
11507
|
rawAttrsForMatcher[attrName] = val;
|
|
@@ -9836,38 +11511,38 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
9836
11511
|
if (hasRawAttrs && typeof jPath === "object" && jPath.updateCurrent) {
|
|
9837
11512
|
jPath.updateCurrent(rawAttrsForMatcher);
|
|
9838
11513
|
}
|
|
9839
|
-
const jPathStr =
|
|
11514
|
+
const jPathStr = options2.jPath ? jPath.toString() : this.readonlyMatcher;
|
|
9840
11515
|
let hasAttrs = false;
|
|
9841
11516
|
for (let i = 0; i < len; i++) {
|
|
9842
11517
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
9843
11518
|
if (this.ignoreAttributesFn(attrName, jPathStr)) continue;
|
|
9844
|
-
let aName =
|
|
11519
|
+
let aName = options2.attributeNamePrefix + attrName;
|
|
9845
11520
|
if (attrName.length) {
|
|
9846
|
-
if (
|
|
9847
|
-
aName =
|
|
11521
|
+
if (options2.transformAttributeName) {
|
|
11522
|
+
aName = options2.transformAttributeName(aName);
|
|
9848
11523
|
}
|
|
9849
|
-
aName = sanitizeName(aName,
|
|
11524
|
+
aName = sanitizeName(aName, options2);
|
|
9850
11525
|
if (matches[i][4] !== void 0) {
|
|
9851
11526
|
const oldVal = processedVals[i];
|
|
9852
|
-
const newVal =
|
|
11527
|
+
const newVal = options2.attributeValueProcessor(attrName, oldVal, jPathStr);
|
|
9853
11528
|
if (newVal === null || newVal === void 0) {
|
|
9854
11529
|
attrs[aName] = oldVal;
|
|
9855
11530
|
} else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
|
|
9856
11531
|
attrs[aName] = newVal;
|
|
9857
11532
|
} else {
|
|
9858
|
-
attrs[aName] = parseValue(oldVal,
|
|
11533
|
+
attrs[aName] = parseValue(oldVal, options2.parseAttributeValue, options2.numberParseOptions);
|
|
9859
11534
|
}
|
|
9860
11535
|
hasAttrs = true;
|
|
9861
|
-
} else if (
|
|
11536
|
+
} else if (options2.allowBooleanAttributes) {
|
|
9862
11537
|
attrs[aName] = true;
|
|
9863
11538
|
hasAttrs = true;
|
|
9864
11539
|
}
|
|
9865
11540
|
}
|
|
9866
11541
|
}
|
|
9867
11542
|
if (!hasAttrs) return;
|
|
9868
|
-
if (
|
|
11543
|
+
if (options2.attributesGroupName && !options2.preserveOrder) {
|
|
9869
11544
|
const attrCollection = {};
|
|
9870
|
-
attrCollection[
|
|
11545
|
+
attrCollection[options2.attributesGroupName] = attrs;
|
|
9871
11546
|
return attrCollection;
|
|
9872
11547
|
}
|
|
9873
11548
|
return attrs;
|
|
@@ -9879,30 +11554,34 @@ var parseXml = function(xmlData) {
|
|
|
9879
11554
|
let currentNode = xmlObj;
|
|
9880
11555
|
let textData = "";
|
|
9881
11556
|
this.matcher.reset();
|
|
11557
|
+
this.entityDecoder.reset();
|
|
9882
11558
|
this.entityExpansionCount = 0;
|
|
9883
11559
|
this.currentExpandedLength = 0;
|
|
9884
|
-
const
|
|
9885
|
-
|
|
11560
|
+
const options2 = this.options;
|
|
11561
|
+
const docTypeReader = new DocTypeReader(options2.processEntities);
|
|
11562
|
+
const xmlLen = xmlData.length;
|
|
11563
|
+
for (let i = 0; i < xmlLen; i++) {
|
|
9886
11564
|
const ch = xmlData[i];
|
|
9887
11565
|
if (ch === "<") {
|
|
9888
|
-
|
|
11566
|
+
const c1 = xmlData.charCodeAt(i + 1);
|
|
11567
|
+
if (c1 === 47) {
|
|
9889
11568
|
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
|
|
9890
11569
|
let tagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
9891
|
-
if (
|
|
11570
|
+
if (options2.removeNSPrefix) {
|
|
9892
11571
|
const colonIndex = tagName.indexOf(":");
|
|
9893
11572
|
if (colonIndex !== -1) {
|
|
9894
11573
|
tagName = tagName.substr(colonIndex + 1);
|
|
9895
11574
|
}
|
|
9896
11575
|
}
|
|
9897
|
-
tagName = transformTagName(
|
|
11576
|
+
tagName = transformTagName(options2.transformTagName, tagName, "", options2).tagName;
|
|
9898
11577
|
if (currentNode) {
|
|
9899
11578
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9900
11579
|
}
|
|
9901
11580
|
const lastTagName = this.matcher.getCurrentTag();
|
|
9902
|
-
if (tagName &&
|
|
11581
|
+
if (tagName && options2.unpairedTagsSet.has(tagName)) {
|
|
9903
11582
|
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
9904
11583
|
}
|
|
9905
|
-
if (lastTagName &&
|
|
11584
|
+
if (lastTagName && options2.unpairedTagsSet.has(lastTagName)) {
|
|
9906
11585
|
this.matcher.pop();
|
|
9907
11586
|
this.tagsNodeStack.pop();
|
|
9908
11587
|
}
|
|
@@ -9911,48 +11590,53 @@ var parseXml = function(xmlData) {
|
|
|
9911
11590
|
currentNode = this.tagsNodeStack.pop();
|
|
9912
11591
|
textData = "";
|
|
9913
11592
|
i = closeIndex;
|
|
9914
|
-
} else if (
|
|
11593
|
+
} else if (c1 === 63) {
|
|
9915
11594
|
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
9916
11595
|
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
9917
11596
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9918
|
-
|
|
11597
|
+
const attsMap = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName, true);
|
|
11598
|
+
if (attsMap) {
|
|
11599
|
+
const ver = attsMap[this.options.attributeNamePrefix + "version"];
|
|
11600
|
+
this.entityDecoder.setXmlVersion(Number(ver) || 1);
|
|
11601
|
+
}
|
|
11602
|
+
if (options2.ignoreDeclaration && tagData.tagName === "?xml" || options2.ignorePiTags) {
|
|
9919
11603
|
} else {
|
|
9920
11604
|
const childNode = new XmlNode(tagData.tagName);
|
|
9921
|
-
childNode.add(
|
|
9922
|
-
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
9923
|
-
childNode[":@"] =
|
|
11605
|
+
childNode.add(options2.textNodeName, "");
|
|
11606
|
+
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options2.ignoreAttributes !== true) {
|
|
11607
|
+
childNode[":@"] = attsMap;
|
|
9924
11608
|
}
|
|
9925
11609
|
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
|
|
9926
11610
|
}
|
|
9927
11611
|
i = tagData.closeIndex + 1;
|
|
9928
|
-
} else if (xmlData.
|
|
11612
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
|
|
9929
11613
|
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
|
|
9930
|
-
if (
|
|
11614
|
+
if (options2.commentPropName) {
|
|
9931
11615
|
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
9932
11616
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9933
|
-
currentNode.add(
|
|
11617
|
+
currentNode.add(options2.commentPropName, [{ [options2.textNodeName]: comment }]);
|
|
9934
11618
|
}
|
|
9935
11619
|
i = endIndex;
|
|
9936
|
-
} else if (xmlData.
|
|
11620
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 68) {
|
|
9937
11621
|
const result = docTypeReader.readDocType(xmlData, i);
|
|
9938
|
-
this.
|
|
11622
|
+
this.entityDecoder.addInputEntities(result.entities);
|
|
9939
11623
|
i = result.i;
|
|
9940
|
-
} else if (xmlData.
|
|
11624
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) {
|
|
9941
11625
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
9942
11626
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
9943
11627
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9944
11628
|
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
9945
11629
|
if (val == void 0) val = "";
|
|
9946
|
-
if (
|
|
9947
|
-
currentNode.add(
|
|
11630
|
+
if (options2.cdataPropName) {
|
|
11631
|
+
currentNode.add(options2.cdataPropName, [{ [options2.textNodeName]: tagExp }]);
|
|
9948
11632
|
} else {
|
|
9949
|
-
currentNode.add(
|
|
11633
|
+
currentNode.add(options2.textNodeName, val);
|
|
9950
11634
|
}
|
|
9951
11635
|
i = closeIndex + 2;
|
|
9952
11636
|
} else {
|
|
9953
|
-
let result = readTagExp(xmlData, i,
|
|
11637
|
+
let result = readTagExp(xmlData, i, options2.removeNSPrefix);
|
|
9954
11638
|
if (!result) {
|
|
9955
|
-
const context = xmlData.substring(Math.max(0, i - 50), Math.min(
|
|
11639
|
+
const context = xmlData.substring(Math.max(0, i - 50), Math.min(xmlLen, i + 50));
|
|
9956
11640
|
throw new Error(`readTagExp returned undefined at position ${i}. Context: "${context}"`);
|
|
9957
11641
|
}
|
|
9958
11642
|
let tagName = result.tagName;
|
|
@@ -9960,8 +11644,8 @@ var parseXml = function(xmlData) {
|
|
|
9960
11644
|
let tagExp = result.tagExp;
|
|
9961
11645
|
let attrExpPresent = result.attrExpPresent;
|
|
9962
11646
|
let closeIndex = result.closeIndex;
|
|
9963
|
-
({ tagName, tagExp } = transformTagName(
|
|
9964
|
-
if (
|
|
11647
|
+
({ tagName, tagExp } = transformTagName(options2.transformTagName, tagName, tagExp, options2));
|
|
11648
|
+
if (options2.strictReservedNames && (tagName === options2.commentPropName || tagName === options2.cdataPropName || tagName === options2.textNodeName || tagName === options2.attributesGroupName)) {
|
|
9965
11649
|
throw new Error(`Invalid tag name: ${tagName}`);
|
|
9966
11650
|
}
|
|
9967
11651
|
if (currentNode && textData) {
|
|
@@ -9970,7 +11654,7 @@ var parseXml = function(xmlData) {
|
|
|
9970
11654
|
}
|
|
9971
11655
|
}
|
|
9972
11656
|
const lastTag = currentNode;
|
|
9973
|
-
if (lastTag &&
|
|
11657
|
+
if (lastTag && options2.unpairedTagsSet.has(lastTag.tagname)) {
|
|
9974
11658
|
currentNode = this.tagsNodeStack.pop();
|
|
9975
11659
|
this.matcher.pop();
|
|
9976
11660
|
}
|
|
@@ -9995,18 +11679,18 @@ var parseXml = function(xmlData) {
|
|
|
9995
11679
|
if (tagName !== tagExp && attrExpPresent) {
|
|
9996
11680
|
prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
|
|
9997
11681
|
if (prefixedAttrs) {
|
|
9998
|
-
rawAttrs = extractRawAttributes(prefixedAttrs,
|
|
11682
|
+
rawAttrs = extractRawAttributes(prefixedAttrs, options2);
|
|
9999
11683
|
}
|
|
10000
11684
|
}
|
|
10001
11685
|
if (tagName !== xmlObj.tagname) {
|
|
10002
|
-
this.isCurrentNodeStopNode = this.isItStopNode(
|
|
11686
|
+
this.isCurrentNodeStopNode = this.isItStopNode();
|
|
10003
11687
|
}
|
|
10004
11688
|
const startIndex = i;
|
|
10005
11689
|
if (this.isCurrentNodeStopNode) {
|
|
10006
11690
|
let tagContent = "";
|
|
10007
11691
|
if (isSelfClosing) {
|
|
10008
11692
|
i = result.closeIndex;
|
|
10009
|
-
} else if (
|
|
11693
|
+
} else if (options2.unpairedTagsSet.has(tagName)) {
|
|
10010
11694
|
i = result.closeIndex;
|
|
10011
11695
|
} else {
|
|
10012
11696
|
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
@@ -10018,13 +11702,13 @@ var parseXml = function(xmlData) {
|
|
|
10018
11702
|
if (prefixedAttrs) {
|
|
10019
11703
|
childNode[":@"] = prefixedAttrs;
|
|
10020
11704
|
}
|
|
10021
|
-
childNode.add(
|
|
11705
|
+
childNode.add(options2.textNodeName, tagContent);
|
|
10022
11706
|
this.matcher.pop();
|
|
10023
11707
|
this.isCurrentNodeStopNode = false;
|
|
10024
11708
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
10025
11709
|
} else {
|
|
10026
11710
|
if (isSelfClosing) {
|
|
10027
|
-
({ tagName, tagExp } = transformTagName(
|
|
11711
|
+
({ tagName, tagExp } = transformTagName(options2.transformTagName, tagName, tagExp, options2));
|
|
10028
11712
|
const childNode = new XmlNode(tagName);
|
|
10029
11713
|
if (prefixedAttrs) {
|
|
10030
11714
|
childNode[":@"] = prefixedAttrs;
|
|
@@ -10032,7 +11716,7 @@ var parseXml = function(xmlData) {
|
|
|
10032
11716
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
10033
11717
|
this.matcher.pop();
|
|
10034
11718
|
this.isCurrentNodeStopNode = false;
|
|
10035
|
-
} else if (
|
|
11719
|
+
} else if (options2.unpairedTagsSet.has(tagName)) {
|
|
10036
11720
|
const childNode = new XmlNode(tagName);
|
|
10037
11721
|
if (prefixedAttrs) {
|
|
10038
11722
|
childNode[":@"] = prefixedAttrs;
|
|
@@ -10044,7 +11728,7 @@ var parseXml = function(xmlData) {
|
|
|
10044
11728
|
continue;
|
|
10045
11729
|
} else {
|
|
10046
11730
|
const childNode = new XmlNode(tagName);
|
|
10047
|
-
if (this.tagsNodeStack.length >
|
|
11731
|
+
if (this.tagsNodeStack.length > options2.maxNestedTags) {
|
|
10048
11732
|
throw new Error("Maximum nested tags exceeded");
|
|
10049
11733
|
}
|
|
10050
11734
|
this.tagsNodeStack.push(currentNode);
|
|
@@ -10094,60 +11778,7 @@ function replaceEntitiesValue(val, tagName, jPath) {
|
|
|
10094
11778
|
return val;
|
|
10095
11779
|
}
|
|
10096
11780
|
}
|
|
10097
|
-
|
|
10098
|
-
const entity = this.docTypeEntities[entityName];
|
|
10099
|
-
const matches = val.match(entity.regx);
|
|
10100
|
-
if (matches) {
|
|
10101
|
-
this.entityExpansionCount += matches.length;
|
|
10102
|
-
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
10103
|
-
throw new Error(
|
|
10104
|
-
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
10105
|
-
);
|
|
10106
|
-
}
|
|
10107
|
-
const lengthBefore = val.length;
|
|
10108
|
-
val = val.replace(entity.regx, entity.val);
|
|
10109
|
-
if (entityConfig.maxExpandedLength) {
|
|
10110
|
-
this.currentExpandedLength += val.length - lengthBefore;
|
|
10111
|
-
if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
|
|
10112
|
-
throw new Error(
|
|
10113
|
-
`Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
|
|
10114
|
-
);
|
|
10115
|
-
}
|
|
10116
|
-
}
|
|
10117
|
-
}
|
|
10118
|
-
}
|
|
10119
|
-
if (val.indexOf("&") === -1) return val;
|
|
10120
|
-
for (const entityName of Object.keys(this.lastEntities)) {
|
|
10121
|
-
const entity = this.lastEntities[entityName];
|
|
10122
|
-
const matches = val.match(entity.regex);
|
|
10123
|
-
if (matches) {
|
|
10124
|
-
this.entityExpansionCount += matches.length;
|
|
10125
|
-
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
10126
|
-
throw new Error(
|
|
10127
|
-
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
10128
|
-
);
|
|
10129
|
-
}
|
|
10130
|
-
}
|
|
10131
|
-
val = val.replace(entity.regex, entity.val);
|
|
10132
|
-
}
|
|
10133
|
-
if (val.indexOf("&") === -1) return val;
|
|
10134
|
-
if (this.options.htmlEntities) {
|
|
10135
|
-
for (const entityName of Object.keys(this.htmlEntities)) {
|
|
10136
|
-
const entity = this.htmlEntities[entityName];
|
|
10137
|
-
const matches = val.match(entity.regex);
|
|
10138
|
-
if (matches) {
|
|
10139
|
-
this.entityExpansionCount += matches.length;
|
|
10140
|
-
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
10141
|
-
throw new Error(
|
|
10142
|
-
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
10143
|
-
);
|
|
10144
|
-
}
|
|
10145
|
-
}
|
|
10146
|
-
val = val.replace(entity.regex, entity.val);
|
|
10147
|
-
}
|
|
10148
|
-
}
|
|
10149
|
-
val = val.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
10150
|
-
return val;
|
|
11781
|
+
return this.entityDecoder.decode(val);
|
|
10151
11782
|
}
|
|
10152
11783
|
function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
10153
11784
|
if (textData) {
|
|
@@ -10166,42 +11797,37 @@ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
|
10166
11797
|
}
|
|
10167
11798
|
return textData;
|
|
10168
11799
|
}
|
|
10169
|
-
function isItStopNode(
|
|
10170
|
-
if (
|
|
10171
|
-
|
|
10172
|
-
if (matcher.matches(stopNodeExpressions[i])) {
|
|
10173
|
-
return true;
|
|
10174
|
-
}
|
|
10175
|
-
}
|
|
10176
|
-
return false;
|
|
11800
|
+
function isItStopNode() {
|
|
11801
|
+
if (this.stopNodeExpressionsSet.size === 0) return false;
|
|
11802
|
+
return this.matcher.matchesAny(this.stopNodeExpressionsSet);
|
|
10177
11803
|
}
|
|
10178
11804
|
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
10179
|
-
let attrBoundary;
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
11805
|
+
let attrBoundary = 0;
|
|
11806
|
+
const len = xmlData.length;
|
|
11807
|
+
const closeCode0 = closingChar.charCodeAt(0);
|
|
11808
|
+
const closeCode1 = closingChar.length > 1 ? closingChar.charCodeAt(1) : -1;
|
|
11809
|
+
let result = "";
|
|
11810
|
+
let segmentStart = i;
|
|
11811
|
+
for (let index = i; index < len; index++) {
|
|
11812
|
+
const code = xmlData.charCodeAt(index);
|
|
10183
11813
|
if (attrBoundary) {
|
|
10184
|
-
if (
|
|
10185
|
-
} else if (
|
|
10186
|
-
attrBoundary =
|
|
10187
|
-
} else if (
|
|
10188
|
-
if (
|
|
10189
|
-
if (xmlData
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
index
|
|
10193
|
-
};
|
|
11814
|
+
if (code === attrBoundary) attrBoundary = 0;
|
|
11815
|
+
} else if (code === 34 || code === 39) {
|
|
11816
|
+
attrBoundary = code;
|
|
11817
|
+
} else if (code === closeCode0) {
|
|
11818
|
+
if (closeCode1 !== -1) {
|
|
11819
|
+
if (xmlData.charCodeAt(index + 1) === closeCode1) {
|
|
11820
|
+
result += xmlData.substring(segmentStart, index);
|
|
11821
|
+
return { data: result, index };
|
|
10194
11822
|
}
|
|
10195
11823
|
} else {
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
index
|
|
10199
|
-
};
|
|
11824
|
+
result += xmlData.substring(segmentStart, index);
|
|
11825
|
+
return { data: result, index };
|
|
10200
11826
|
}
|
|
10201
|
-
} else if (
|
|
10202
|
-
|
|
11827
|
+
} else if (code === 9 && !attrBoundary) {
|
|
11828
|
+
result += xmlData.substring(segmentStart, index) + " ";
|
|
11829
|
+
segmentStart = index + 1;
|
|
10203
11830
|
}
|
|
10204
|
-
tagExp += ch;
|
|
10205
11831
|
}
|
|
10206
11832
|
}
|
|
10207
11833
|
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
@@ -10212,6 +11838,11 @@ function findClosingIndex(xmlData, str, i, errMsg) {
|
|
|
10212
11838
|
return closingIndex + str.length - 1;
|
|
10213
11839
|
}
|
|
10214
11840
|
}
|
|
11841
|
+
function findClosingChar(xmlData, char, i, errMsg) {
|
|
11842
|
+
const closingIndex = xmlData.indexOf(char, i);
|
|
11843
|
+
if (closingIndex === -1) throw new Error(errMsg);
|
|
11844
|
+
return closingIndex;
|
|
11845
|
+
}
|
|
10215
11846
|
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
10216
11847
|
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
10217
11848
|
if (!result) return;
|
|
@@ -10243,10 +11874,12 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
|
10243
11874
|
function readStopNodeData(xmlData, tagName, i) {
|
|
10244
11875
|
const startIndex = i;
|
|
10245
11876
|
let openTagCount = 1;
|
|
10246
|
-
|
|
11877
|
+
const xmllen = xmlData.length;
|
|
11878
|
+
for (; i < xmllen; i++) {
|
|
10247
11879
|
if (xmlData[i] === "<") {
|
|
10248
|
-
|
|
10249
|
-
|
|
11880
|
+
const c1 = xmlData.charCodeAt(i + 1);
|
|
11881
|
+
if (c1 === 47) {
|
|
11882
|
+
const closeIndex = findClosingChar(xmlData, ">", i, `${tagName} is not closed`);
|
|
10250
11883
|
let closeTagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
10251
11884
|
if (closeTagName === tagName) {
|
|
10252
11885
|
openTagCount--;
|
|
@@ -10258,13 +11891,13 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
10258
11891
|
}
|
|
10259
11892
|
}
|
|
10260
11893
|
i = closeIndex;
|
|
10261
|
-
} else if (
|
|
11894
|
+
} else if (c1 === 63) {
|
|
10262
11895
|
const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
|
|
10263
11896
|
i = closeIndex;
|
|
10264
|
-
} else if (xmlData.
|
|
11897
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
|
|
10265
11898
|
const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
|
|
10266
11899
|
i = closeIndex;
|
|
10267
|
-
} else if (xmlData.
|
|
11900
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) {
|
|
10268
11901
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
10269
11902
|
i = closeIndex;
|
|
10270
11903
|
} else {
|
|
@@ -10294,14 +11927,6 @@ function parseValue(val, shouldParse, options2) {
|
|
|
10294
11927
|
}
|
|
10295
11928
|
}
|
|
10296
11929
|
}
|
|
10297
|
-
function fromCodePoint(str, base, prefix) {
|
|
10298
|
-
const codePoint = Number.parseInt(str, base);
|
|
10299
|
-
if (codePoint >= 0 && codePoint <= 1114111) {
|
|
10300
|
-
return String.fromCodePoint(codePoint);
|
|
10301
|
-
} else {
|
|
10302
|
-
return prefix + str + ";";
|
|
10303
|
-
}
|
|
10304
|
-
}
|
|
10305
11930
|
function transformTagName(fn, tagName, tagExp, options2) {
|
|
10306
11931
|
if (fn) {
|
|
10307
11932
|
const newTagName = fn(tagName);
|
|
@@ -10322,7 +11947,7 @@ function sanitizeName(name, options2) {
|
|
|
10322
11947
|
return name;
|
|
10323
11948
|
}
|
|
10324
11949
|
|
|
10325
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
11950
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
|
|
10326
11951
|
var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
|
|
10327
11952
|
function stripAttributePrefix(attrs, prefix) {
|
|
10328
11953
|
if (!attrs || typeof attrs !== "object") return {};
|
|
@@ -10431,7 +12056,7 @@ function isLeafTag(obj, options2) {
|
|
|
10431
12056
|
return false;
|
|
10432
12057
|
}
|
|
10433
12058
|
|
|
10434
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
12059
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
|
|
10435
12060
|
var XMLParser = class {
|
|
10436
12061
|
constructor(options2) {
|
|
10437
12062
|
this.externalEntities = {};
|
|
@@ -10455,8 +12080,7 @@ var XMLParser = class {
|
|
|
10455
12080
|
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
10456
12081
|
}
|
|
10457
12082
|
}
|
|
10458
|
-
const orderedObjParser = new OrderedObjParser(this.options);
|
|
10459
|
-
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
12083
|
+
const orderedObjParser = new OrderedObjParser(this.options, this.externalEntities);
|
|
10460
12084
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
10461
12085
|
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
10462
12086
|
else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
|
|
@@ -11102,6 +12726,12 @@ var DependencyManager = class _DependencyManager {
|
|
|
11102
12726
|
};
|
|
11103
12727
|
}
|
|
11104
12728
|
createImportPath(packageName, namespace, version) {
|
|
12729
|
+
if (this.config.externalDeps) {
|
|
12730
|
+
const override3 = this.config.externalPackages?.[namespace];
|
|
12731
|
+
if (override3) return override3;
|
|
12732
|
+
const importName2 = transformImportName(packageName);
|
|
12733
|
+
return `${this.config.npmScope}/${importName2}`;
|
|
12734
|
+
}
|
|
11105
12735
|
if (!this.config.package) {
|
|
11106
12736
|
return `gi://${namespace}?version=${version}`;
|
|
11107
12737
|
}
|
|
@@ -18756,19 +20386,21 @@ var NSRegistry = class {
|
|
|
18756
20386
|
);
|
|
18757
20387
|
}
|
|
18758
20388
|
transform(options2) {
|
|
18759
|
-
const GLib = this.
|
|
18760
|
-
const Gio = this.
|
|
18761
|
-
const GObject = this.
|
|
18762
|
-
Gio.package_version = [...GLib.package_version];
|
|
18763
|
-
GObject.package_version = [...GLib.package_version];
|
|
20389
|
+
const GLib = this.namespace("GLib", "2.0");
|
|
20390
|
+
const Gio = this.namespace("Gio", "2.0");
|
|
20391
|
+
const GObject = this.namespace("GObject", "2.0");
|
|
20392
|
+
if (GLib && Gio) Gio.package_version = [...GLib.package_version];
|
|
20393
|
+
if (GLib && GObject) GObject.package_version = [...GLib.package_version];
|
|
18764
20394
|
const interfaceVisitor = new InterfaceVisitor();
|
|
18765
20395
|
this.registerTransformation(interfaceVisitor);
|
|
18766
20396
|
const classVisitor = new ClassVisitor();
|
|
18767
20397
|
this.registerTransformation(classVisitor);
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
20398
|
+
if (GLib && Gio) {
|
|
20399
|
+
console.log("Adding generics...");
|
|
20400
|
+
generify(this, options2.inferGenerics);
|
|
20401
|
+
console.log("Injecting types...");
|
|
20402
|
+
inject(this);
|
|
20403
|
+
}
|
|
18772
20404
|
}
|
|
18773
20405
|
defaultVersionOf(name) {
|
|
18774
20406
|
if (name === "GLib" || name === "Gio" || name === "GObject") {
|
|
@@ -19365,6 +20997,8 @@ var defaults = {
|
|
|
19365
20997
|
package: false,
|
|
19366
20998
|
reporter: false,
|
|
19367
20999
|
reporterOutput: "ts-for-gir-report.json",
|
|
21000
|
+
externalDeps: false,
|
|
21001
|
+
allowMissingDeps: false,
|
|
19368
21002
|
combined: true,
|
|
19369
21003
|
/** Default theme for `ts-for-gir doc` (HTML documentation). */
|
|
19370
21004
|
theme: "gi-docgen"
|
|
@@ -19554,6 +21188,23 @@ var options = {
|
|
|
19554
21188
|
description: "Output file path for the reporter (default: ts-for-gir-report.json)",
|
|
19555
21189
|
default: defaults.reporterOutput,
|
|
19556
21190
|
normalize: true
|
|
21191
|
+
},
|
|
21192
|
+
externalDeps: {
|
|
21193
|
+
type: "boolean",
|
|
21194
|
+
description: "Emit imports from installed @girs/* npm packages instead of regenerating dep types. Implies single-file ambient .d.ts output. Designed for project-local Vala/C bridges. Strict by default \u2014 missing transitive dep GIRs abort the run; pass --allow-missing-deps to override.",
|
|
21195
|
+
default: defaults.externalDeps,
|
|
21196
|
+
normalize: true
|
|
21197
|
+
},
|
|
21198
|
+
allowMissingDeps: {
|
|
21199
|
+
type: "boolean",
|
|
21200
|
+
description: "In --external-deps mode, allow generation to proceed when app-specific transitive dep GIRs are missing (e.g. CI without libsoup3-devel). Note: GLib/Gio/GObject GIRs are still architecturally required for class-hierarchy resolution. Default strict behavior prevents silent type-quality drift between environments.",
|
|
21201
|
+
default: defaults.allowMissingDeps,
|
|
21202
|
+
normalize: true
|
|
21203
|
+
},
|
|
21204
|
+
externalPackage: {
|
|
21205
|
+
type: "string",
|
|
21206
|
+
description: "Override the default namespace\u2192npm package mapping for --external-deps mode. Repeatable. Format: 'Namespace=@scope/pkg'. Example: --external-package Soup=@girs/soup-3.0",
|
|
21207
|
+
array: true
|
|
19557
21208
|
}
|
|
19558
21209
|
};
|
|
19559
21210
|
var generateOptions = {
|
|
@@ -19577,7 +21228,10 @@ var generateOptions = {
|
|
|
19577
21228
|
noAdvancedVariants: options.noAdvancedVariants,
|
|
19578
21229
|
package: options.package,
|
|
19579
21230
|
reporter: options.reporter,
|
|
19580
|
-
reporterOutput: options.reporterOutput
|
|
21231
|
+
reporterOutput: options.reporterOutput,
|
|
21232
|
+
externalDeps: options.externalDeps,
|
|
21233
|
+
allowMissingDeps: options.allowMissingDeps,
|
|
21234
|
+
externalPackage: options.externalPackage
|
|
19581
21235
|
};
|
|
19582
21236
|
var listOptions = {
|
|
19583
21237
|
modules: options.modules,
|
|
@@ -19769,6 +21423,18 @@ function getOptionsGeneration(config) {
|
|
|
19769
21423
|
};
|
|
19770
21424
|
return generateConfig;
|
|
19771
21425
|
}
|
|
21426
|
+
function parseExternalPackagePairs(pairs) {
|
|
21427
|
+
if (!pairs || pairs.length === 0) return void 0;
|
|
21428
|
+
const map2 = {};
|
|
21429
|
+
for (const pair of pairs) {
|
|
21430
|
+
const eq = pair.indexOf("=");
|
|
21431
|
+
if (eq < 1) continue;
|
|
21432
|
+
const ns = pair.slice(0, eq).trim();
|
|
21433
|
+
const pkg = pair.slice(eq + 1).trim();
|
|
21434
|
+
if (ns && pkg) map2[ns] = pkg;
|
|
21435
|
+
}
|
|
21436
|
+
return Object.keys(map2).length > 0 ? map2 : void 0;
|
|
21437
|
+
}
|
|
19772
21438
|
function validate2(config) {
|
|
19773
21439
|
return config;
|
|
19774
21440
|
}
|
|
@@ -19786,9 +21452,16 @@ function mergeConfigValue(userConfig, configFileData, key, optionDefault, valida
|
|
|
19786
21452
|
async function load(cliOptions) {
|
|
19787
21453
|
const configFile = await loadConfigFile(cliOptions.configName);
|
|
19788
21454
|
const configFileData = configFile?.config || {};
|
|
21455
|
+
const externalPackagesFromCli = parseExternalPackagePairs(
|
|
21456
|
+
cliOptions.externalPackage
|
|
21457
|
+
);
|
|
21458
|
+
const { externalPackage: _externalPackage, ...cliOptionsClean } = cliOptions;
|
|
19789
21459
|
const userConfig = {
|
|
19790
|
-
...
|
|
21460
|
+
...cliOptionsClean
|
|
19791
21461
|
};
|
|
21462
|
+
if (externalPackagesFromCli) {
|
|
21463
|
+
userConfig.externalPackages = externalPackagesFromCli;
|
|
21464
|
+
}
|
|
19792
21465
|
if (configFileData) {
|
|
19793
21466
|
const booleanKeys = [
|
|
19794
21467
|
["verbose", options.verbose.default],
|
|
@@ -19803,6 +21476,8 @@ async function load(cliOptions) {
|
|
|
19803
21476
|
["noAdvancedVariants", options.noAdvancedVariants.default],
|
|
19804
21477
|
["package", options.package.default],
|
|
19805
21478
|
["reporter", options.reporter.default],
|
|
21479
|
+
["externalDeps", options.externalDeps.default],
|
|
21480
|
+
["allowMissingDeps", options.allowMissingDeps.default],
|
|
19806
21481
|
["combined", docOptions.combined.default],
|
|
19807
21482
|
["merge", docOptions.merge.default]
|
|
19808
21483
|
];
|
|
@@ -19822,13 +21497,19 @@ async function load(cliOptions) {
|
|
|
19822
21497
|
mergeConfigValue(userConfig, configFileData, key, defaultVal);
|
|
19823
21498
|
}
|
|
19824
21499
|
const arrayKeys = [
|
|
19825
|
-
["girDirectories", options.girDirectories.default],
|
|
19826
21500
|
["ignore", options.ignore.default],
|
|
19827
21501
|
["modules", options.modules.default]
|
|
19828
21502
|
];
|
|
19829
21503
|
for (const [key, defaultVal] of arrayKeys) {
|
|
19830
21504
|
mergeConfigValue(userConfig, configFileData, key, defaultVal);
|
|
19831
21505
|
}
|
|
21506
|
+
if (configFileData.girDirectories?.length) {
|
|
21507
|
+
const current = userConfig.girDirectories;
|
|
21508
|
+
const toAdd = configFileData.girDirectories.filter((d) => !current.includes(d));
|
|
21509
|
+
if (toAdd.length > 0) {
|
|
21510
|
+
userConfig.girDirectories = [...toAdd, ...current];
|
|
21511
|
+
}
|
|
21512
|
+
}
|
|
19832
21513
|
if (userConfig.root === options.root.default && (configFileData.root || configFile?.filepath)) {
|
|
19833
21514
|
userConfig.root = configFileData.root || (configFile?.filepath ? dirname5(configFile.filepath) : options.root.default);
|
|
19834
21515
|
}
|
|
@@ -19836,6 +21517,9 @@ async function load(cliOptions) {
|
|
|
19836
21517
|
if (isDefaultOutdir && configFileData.outdir) {
|
|
19837
21518
|
userConfig.outdir = userConfig.print ? null : configFileData.outdir;
|
|
19838
21519
|
}
|
|
21520
|
+
if (!externalPackagesFromCli && configFileData.externalPackages) {
|
|
21521
|
+
userConfig.externalPackages = configFileData.externalPackages;
|
|
21522
|
+
}
|
|
19839
21523
|
}
|
|
19840
21524
|
const resolveToRoot = (path) => path.startsWith("/") ? path : resolve4(userConfig.root, path);
|
|
19841
21525
|
if (userConfig.outdir) {
|
|
@@ -20512,7 +22196,9 @@ var ModuleLoader = class {
|
|
|
20512
22196
|
const girModule = await this.loadAndCreateGirModule(dependency);
|
|
20513
22197
|
if (!girModule) {
|
|
20514
22198
|
if (!failedGirModules.has(dependency.packageName)) {
|
|
20515
|
-
this.
|
|
22199
|
+
if (!this.config.externalDeps) {
|
|
22200
|
+
this.log.warn(WARN_NO_GIR_FILE_FOUND_FOR_PACKAGE(dependency.packageName));
|
|
22201
|
+
}
|
|
20516
22202
|
failedGirModules.add(dependency.packageName);
|
|
20517
22203
|
}
|
|
20518
22204
|
} else if (girModule?.packageName) {
|
|
@@ -20566,18 +22252,33 @@ var ModuleLoader = class {
|
|
|
20566
22252
|
const GObject = await this.dependencyManager.get("GObject", "2.0");
|
|
20567
22253
|
const Cairo = await this.dependencyManager.get("cairo", "1.0");
|
|
20568
22254
|
const dependencies = await this.fileFinder.girFilePathToDependencies(girFiles);
|
|
22255
|
+
const { loaded: forceLoaded, failed: forceFailed } = await this.loadGirModules(
|
|
22256
|
+
[GLib, Gio, GObject, Cairo],
|
|
22257
|
+
ignore,
|
|
22258
|
+
[],
|
|
22259
|
+
0 /* DEPENDENCE */
|
|
22260
|
+
);
|
|
20569
22261
|
const { loaded, failed } = await this.loadGirModules(
|
|
20570
|
-
|
|
20571
|
-
GLib
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20577
|
-
)
|
|
20578
|
-
],
|
|
20579
|
-
ignore
|
|
22262
|
+
dependencies.filter(
|
|
22263
|
+
(dep) => dep.namespace !== "GLib" && dep.namespace !== "Gio" && dep.namespace !== "GObject" && dep.namespace !== "cairo"
|
|
22264
|
+
),
|
|
22265
|
+
ignore,
|
|
22266
|
+
forceLoaded,
|
|
22267
|
+
1 /* BY_HAND */,
|
|
22268
|
+
forceFailed
|
|
20580
22269
|
);
|
|
22270
|
+
if (this.config.externalDeps && !this.config.allowMissingDeps && failed.size > 0) {
|
|
22271
|
+
const exempt = /* @__PURE__ */ new Set(["GLib-2.0", "Gio-2.0", "GObject-2.0", "cairo-1.0"]);
|
|
22272
|
+
const critical = Array.from(failed).filter((pkg) => !exempt.has(pkg));
|
|
22273
|
+
if (critical.length > 0) {
|
|
22274
|
+
throw new Error(
|
|
22275
|
+
`Missing GIR files for transitive dependencies in --external-deps mode:
|
|
22276
|
+
` + critical.map((pkg) => ` - ${pkg}`).join("\n") + `
|
|
22277
|
+
|
|
22278
|
+
Install the corresponding -devel packages, add their directories to --girDirectories, or pass --allow-missing-deps to generate anyway (warning: degraded type quality).`
|
|
22279
|
+
);
|
|
22280
|
+
}
|
|
22281
|
+
}
|
|
20581
22282
|
let keep = [];
|
|
20582
22283
|
if (doNotAskForVersionOnConflict) {
|
|
20583
22284
|
keep = loaded;
|
|
@@ -22924,6 +24625,7 @@ var TypeDefinitionGenerator = class _TypeDefinitionGenerator {
|
|
|
22924
24625
|
}
|
|
22925
24626
|
async exportGjs() {
|
|
22926
24627
|
const { config, dependencyManager } = this;
|
|
24628
|
+
if (config.externalDeps) return;
|
|
22927
24629
|
if (!config.outdir) return;
|
|
22928
24630
|
const gjs2 = dependencyManager.getGjs();
|
|
22929
24631
|
const templateProcessor = new TemplateProcessor(
|
|
@@ -23014,7 +24716,7 @@ ${domContent.append}`, config.outdir, "dom.d.ts");
|
|
|
23014
24716
|
}
|
|
23015
24717
|
async finish(girModules) {
|
|
23016
24718
|
await this.exportGjs();
|
|
23017
|
-
if (!this.config.package) {
|
|
24719
|
+
if (!this.config.package && !this.config.externalDeps) {
|
|
23018
24720
|
await this.exportAllModules(girModules);
|
|
23019
24721
|
}
|
|
23020
24722
|
}
|
|
@@ -25874,7 +27576,7 @@ import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
|
25874
27576
|
import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
|
|
25875
27577
|
function getTsForGirVersion() {
|
|
25876
27578
|
if (true) {
|
|
25877
|
-
return "4.0.0-rc.
|
|
27579
|
+
return "4.0.0-rc.6";
|
|
25878
27580
|
}
|
|
25879
27581
|
const __dirname3 = dirname8(fileURLToPath5(import.meta.url));
|
|
25880
27582
|
return JSON.parse(readFileSync7(join14(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
@@ -26580,7 +28282,8 @@ async function runGenerationCommand(args, options2) {
|
|
|
26580
28282
|
}
|
|
26581
28283
|
tsForGir = new GenerationHandler(generateConfig, options2.generatorType, registry);
|
|
26582
28284
|
moduleLoader.parse(keep);
|
|
26583
|
-
const
|
|
28285
|
+
const toGenerate = generateConfig.externalDeps ? keep.filter((m) => m.resolvedBy === 1 /* BY_HAND */) : keep;
|
|
28286
|
+
const girModules = Array.from(toGenerate).map((girModuleResolvedBy) => girModuleResolvedBy.module);
|
|
26584
28287
|
await tsForGir.start(girModules);
|
|
26585
28288
|
} catch (error) {
|
|
26586
28289
|
if (generateConfig.reporter && tsForGir) {
|