html-minifier-next 1.4.2 → 1.4.3
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/README.md +2 -2
- package/cli.js +1 -1
- package/dist/htmlminifier.cjs +41 -13
- package/dist/htmlminifier.esm.bundle.js +41 -13
- package/dist/htmlminifier.umd.bundle.js +41 -13
- package/dist/htmlminifier.umd.bundle.min.js +1 -1
- package/package.json +2 -2
- package/src/htmlminifier.js +41 -13
package/README.md
CHANGED
|
@@ -176,7 +176,7 @@ Most of the options are disabled by default.
|
|
|
176
176
|
| `maxLineLength` | Specify a maximum line length; compressed output will be split by newlines at valid HTML split-points | |
|
|
177
177
|
| `minifyCSS` | Minify CSS in `style` elements and `style` attributes (uses [clean-css](https://github.com/jakubpawlowicz/clean-css)) | `false` (could be `true`, `Object`, `Function(text, type)`) |
|
|
178
178
|
| `minifyJS` | Minify JavaScript in `script` elements and event attributes (uses [Terser](https://github.com/terser/terser)) | `false` (could be `true`, `Object`, `Function(text, inline)`) |
|
|
179
|
-
| `minifyURLs` | Minify URLs in various attributes (uses [relateurl](https://github.com/stevenvachon/relateurl)) | `false` (could be `String`, `Object`, `Function(text)`) |
|
|
179
|
+
| `minifyURLs` | Minify URLs in various attributes (uses [relateurl](https://github.com/stevenvachon/relateurl)) | `false` (could be `String`, `Object`, `Function(text)`, `async Function(text)`) |
|
|
180
180
|
| `noNewlinesBeforeTagClose` | Never add a newline before a tag that closes an element | `false` |
|
|
181
181
|
| `preserveLineBreaks` | Always collapse to 1 line break (never remove it entirely) when whitespace between tags includes a line break—use with `collapseWhitespace=true` | `false` |
|
|
182
182
|
| `preventAttributesEscaping` | Prevents the escaping of the values of attributes | `false` |
|
|
@@ -298,4 +298,4 @@ npm run serve
|
|
|
298
298
|
|
|
299
299
|
## Acknowledgements
|
|
300
300
|
|
|
301
|
-
With many thanks to all the previous authors of HTML Minifier, especially [Juriy Zaytsev](https://github.com/kangax), and to everyone who helped make this new edition better,
|
|
301
|
+
With many thanks to all the previous authors of HTML Minifier, especially [Juriy Zaytsev](https://github.com/kangax), and to everyone who helped make this new edition better, particularly [Daniel Ruf](https://github.com/DanielRuf) and [Jonas Geiler](https://github.com/jonasgeiler).
|
package/cli.js
CHANGED
|
@@ -125,7 +125,7 @@ const mainOptions = {
|
|
|
125
125
|
preventAttributesEscaping: 'Prevents the escaping of the values of attributes',
|
|
126
126
|
processConditionalComments: 'Process contents of conditional comments through minifier',
|
|
127
127
|
processScripts: ['Array of strings corresponding to types of “script” elements to process through minifier (e.g., “text/ng-template”, “text/x-handlebars-template”, etc.)', parseJSONArray],
|
|
128
|
-
quoteCharacter: ['Type of quote to use for attribute values (“\'” or
|
|
128
|
+
quoteCharacter: ['Type of quote to use for attribute values (“\'” or “"”)', parseString],
|
|
129
129
|
removeAttributeQuotes: 'Remove quotes around attributes when possible',
|
|
130
130
|
removeComments: 'Strip HTML comments',
|
|
131
131
|
removeEmptyAttributes: 'Remove all attributes with whitespace-only values',
|
package/dist/htmlminifier.cjs
CHANGED
|
@@ -729,14 +729,15 @@ function isNumberTypeAttribute(attrName, tag) {
|
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
function isLinkType(tag, attrs, value) {
|
|
732
|
-
if (tag !== 'link')
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
return true;
|
|
732
|
+
if (tag !== 'link') return false;
|
|
733
|
+
const needle = String(value).toLowerCase();
|
|
734
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
735
|
+
if (attrs[i].name.toLowerCase() === 'rel') {
|
|
736
|
+
const tokens = String(attrs[i].value).toLowerCase().split(/\s+/);
|
|
737
|
+
if (tokens.includes(needle)) return true;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
+
return false;
|
|
740
741
|
}
|
|
741
742
|
|
|
742
743
|
function isMediaQuery(tag, attrs, attrName) {
|
|
@@ -763,7 +764,16 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
763
764
|
return attrValue;
|
|
764
765
|
} else if (isUriTypeAttribute(attrName, tag)) {
|
|
765
766
|
attrValue = trimWhitespace(attrValue);
|
|
766
|
-
|
|
767
|
+
if (isLinkType(tag, attrs, 'canonical')) {
|
|
768
|
+
return attrValue;
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
const out = await options.minifyURLs(attrValue);
|
|
772
|
+
return typeof out === 'string' ? out : attrValue;
|
|
773
|
+
} catch (err) {
|
|
774
|
+
options.log && options.log(err);
|
|
775
|
+
return attrValue;
|
|
776
|
+
}
|
|
767
777
|
} else if (isNumberTypeAttribute(attrName, tag)) {
|
|
768
778
|
return trimWhitespace(attrValue);
|
|
769
779
|
} else if (attrName === 'style') {
|
|
@@ -777,7 +787,7 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
777
787
|
return attrValue;
|
|
778
788
|
} else if (isSrcset(attrName, tag)) {
|
|
779
789
|
// https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-srcset
|
|
780
|
-
attrValue = trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(function (candidate) {
|
|
790
|
+
attrValue = (await Promise.all(trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(async function (candidate) {
|
|
781
791
|
let url = candidate;
|
|
782
792
|
let descriptor = '';
|
|
783
793
|
const match = candidate.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);
|
|
@@ -789,8 +799,14 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
789
799
|
descriptor = ' ' + num + suffix;
|
|
790
800
|
}
|
|
791
801
|
}
|
|
792
|
-
|
|
793
|
-
|
|
802
|
+
try {
|
|
803
|
+
const out = await options.minifyURLs(url);
|
|
804
|
+
return (typeof out === 'string' ? out : url) + descriptor;
|
|
805
|
+
} catch (err) {
|
|
806
|
+
options.log && options.log(err);
|
|
807
|
+
return url + descriptor;
|
|
808
|
+
}
|
|
809
|
+
}))).join(', ');
|
|
794
810
|
} else if (isMetaViewport(tag, attrs) && attrName === 'content') {
|
|
795
811
|
attrValue = attrValue.replace(/\s+/g, '').replace(/[0-9]+\.[0-9]+/g, function (numString) {
|
|
796
812
|
// "0.90000" -> "0.9"
|
|
@@ -1181,9 +1197,21 @@ const processOptions = (inputOptions) => {
|
|
|
1181
1197
|
const cleanCssOptions = typeof option === 'object' ? option : {};
|
|
1182
1198
|
|
|
1183
1199
|
options.minifyCSS = async function (text, type) {
|
|
1184
|
-
text =
|
|
1185
|
-
|
|
1186
|
-
|
|
1200
|
+
text = await replaceAsync(
|
|
1201
|
+
text,
|
|
1202
|
+
/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/ig,
|
|
1203
|
+
async function (match, prefix, dq, sq, unq, suffix) {
|
|
1204
|
+
const quote = dq != null ? '"' : (sq != null ? "'" : '');
|
|
1205
|
+
const url = dq ?? sq ?? unq ?? '';
|
|
1206
|
+
try {
|
|
1207
|
+
const out = await options.minifyURLs(url);
|
|
1208
|
+
return prefix + quote + (typeof out === 'string' ? out : url) + quote + suffix;
|
|
1209
|
+
} catch (err) {
|
|
1210
|
+
options.log && options.log(err);
|
|
1211
|
+
return match;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
);
|
|
1187
1215
|
|
|
1188
1216
|
const inputCSS = wrapCSS(text, type);
|
|
1189
1217
|
|
|
@@ -60821,14 +60821,15 @@ function isNumberTypeAttribute(attrName, tag) {
|
|
|
60821
60821
|
}
|
|
60822
60822
|
|
|
60823
60823
|
function isLinkType(tag, attrs, value) {
|
|
60824
|
-
if (tag !== 'link')
|
|
60825
|
-
|
|
60826
|
-
|
|
60827
|
-
|
|
60828
|
-
|
|
60829
|
-
return true;
|
|
60824
|
+
if (tag !== 'link') return false;
|
|
60825
|
+
const needle = String(value).toLowerCase();
|
|
60826
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
60827
|
+
if (attrs[i].name.toLowerCase() === 'rel') {
|
|
60828
|
+
const tokens = String(attrs[i].value).toLowerCase().split(/\s+/);
|
|
60829
|
+
if (tokens.includes(needle)) return true;
|
|
60830
60830
|
}
|
|
60831
60831
|
}
|
|
60832
|
+
return false;
|
|
60832
60833
|
}
|
|
60833
60834
|
|
|
60834
60835
|
function isMediaQuery(tag, attrs, attrName) {
|
|
@@ -60855,7 +60856,16 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
60855
60856
|
return attrValue;
|
|
60856
60857
|
} else if (isUriTypeAttribute(attrName, tag)) {
|
|
60857
60858
|
attrValue = trimWhitespace(attrValue);
|
|
60858
|
-
|
|
60859
|
+
if (isLinkType(tag, attrs, 'canonical')) {
|
|
60860
|
+
return attrValue;
|
|
60861
|
+
}
|
|
60862
|
+
try {
|
|
60863
|
+
const out = await options.minifyURLs(attrValue);
|
|
60864
|
+
return typeof out === 'string' ? out : attrValue;
|
|
60865
|
+
} catch (err) {
|
|
60866
|
+
options.log && options.log(err);
|
|
60867
|
+
return attrValue;
|
|
60868
|
+
}
|
|
60859
60869
|
} else if (isNumberTypeAttribute(attrName, tag)) {
|
|
60860
60870
|
return trimWhitespace(attrValue);
|
|
60861
60871
|
} else if (attrName === 'style') {
|
|
@@ -60869,7 +60879,7 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
60869
60879
|
return attrValue;
|
|
60870
60880
|
} else if (isSrcset(attrName, tag)) {
|
|
60871
60881
|
// https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-srcset
|
|
60872
|
-
attrValue = trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(function (candidate) {
|
|
60882
|
+
attrValue = (await Promise.all(trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(async function (candidate) {
|
|
60873
60883
|
let url = candidate;
|
|
60874
60884
|
let descriptor = '';
|
|
60875
60885
|
const match = candidate.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);
|
|
@@ -60881,8 +60891,14 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
60881
60891
|
descriptor = ' ' + num + suffix;
|
|
60882
60892
|
}
|
|
60883
60893
|
}
|
|
60884
|
-
|
|
60885
|
-
|
|
60894
|
+
try {
|
|
60895
|
+
const out = await options.minifyURLs(url);
|
|
60896
|
+
return (typeof out === 'string' ? out : url) + descriptor;
|
|
60897
|
+
} catch (err) {
|
|
60898
|
+
options.log && options.log(err);
|
|
60899
|
+
return url + descriptor;
|
|
60900
|
+
}
|
|
60901
|
+
}))).join(', ');
|
|
60886
60902
|
} else if (isMetaViewport(tag, attrs) && attrName === 'content') {
|
|
60887
60903
|
attrValue = attrValue.replace(/\s+/g, '').replace(/[0-9]+\.[0-9]+/g, function (numString) {
|
|
60888
60904
|
// "0.90000" -> "0.9"
|
|
@@ -61273,9 +61289,21 @@ const processOptions = (inputOptions) => {
|
|
|
61273
61289
|
const cleanCssOptions = typeof option === 'object' ? option : {};
|
|
61274
61290
|
|
|
61275
61291
|
options.minifyCSS = async function (text, type) {
|
|
61276
|
-
text =
|
|
61277
|
-
|
|
61278
|
-
|
|
61292
|
+
text = await replaceAsync(
|
|
61293
|
+
text,
|
|
61294
|
+
/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/ig,
|
|
61295
|
+
async function (match, prefix, dq, sq, unq, suffix) {
|
|
61296
|
+
const quote = dq != null ? '"' : (sq != null ? "'" : '');
|
|
61297
|
+
const url = dq ?? sq ?? unq ?? '';
|
|
61298
|
+
try {
|
|
61299
|
+
const out = await options.minifyURLs(url);
|
|
61300
|
+
return prefix + quote + (typeof out === 'string' ? out : url) + quote + suffix;
|
|
61301
|
+
} catch (err) {
|
|
61302
|
+
options.log && options.log(err);
|
|
61303
|
+
return match;
|
|
61304
|
+
}
|
|
61305
|
+
}
|
|
61306
|
+
);
|
|
61279
61307
|
|
|
61280
61308
|
const inputCSS = wrapCSS(text, type);
|
|
61281
61309
|
|
|
@@ -60827,14 +60827,15 @@
|
|
|
60827
60827
|
}
|
|
60828
60828
|
|
|
60829
60829
|
function isLinkType(tag, attrs, value) {
|
|
60830
|
-
if (tag !== 'link')
|
|
60831
|
-
|
|
60832
|
-
|
|
60833
|
-
|
|
60834
|
-
|
|
60835
|
-
return true;
|
|
60830
|
+
if (tag !== 'link') return false;
|
|
60831
|
+
const needle = String(value).toLowerCase();
|
|
60832
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
60833
|
+
if (attrs[i].name.toLowerCase() === 'rel') {
|
|
60834
|
+
const tokens = String(attrs[i].value).toLowerCase().split(/\s+/);
|
|
60835
|
+
if (tokens.includes(needle)) return true;
|
|
60836
60836
|
}
|
|
60837
60837
|
}
|
|
60838
|
+
return false;
|
|
60838
60839
|
}
|
|
60839
60840
|
|
|
60840
60841
|
function isMediaQuery(tag, attrs, attrName) {
|
|
@@ -60861,7 +60862,16 @@
|
|
|
60861
60862
|
return attrValue;
|
|
60862
60863
|
} else if (isUriTypeAttribute(attrName, tag)) {
|
|
60863
60864
|
attrValue = trimWhitespace(attrValue);
|
|
60864
|
-
|
|
60865
|
+
if (isLinkType(tag, attrs, 'canonical')) {
|
|
60866
|
+
return attrValue;
|
|
60867
|
+
}
|
|
60868
|
+
try {
|
|
60869
|
+
const out = await options.minifyURLs(attrValue);
|
|
60870
|
+
return typeof out === 'string' ? out : attrValue;
|
|
60871
|
+
} catch (err) {
|
|
60872
|
+
options.log && options.log(err);
|
|
60873
|
+
return attrValue;
|
|
60874
|
+
}
|
|
60865
60875
|
} else if (isNumberTypeAttribute(attrName, tag)) {
|
|
60866
60876
|
return trimWhitespace(attrValue);
|
|
60867
60877
|
} else if (attrName === 'style') {
|
|
@@ -60875,7 +60885,7 @@
|
|
|
60875
60885
|
return attrValue;
|
|
60876
60886
|
} else if (isSrcset(attrName, tag)) {
|
|
60877
60887
|
// https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-srcset
|
|
60878
|
-
attrValue = trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(function (candidate) {
|
|
60888
|
+
attrValue = (await Promise.all(trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(async function (candidate) {
|
|
60879
60889
|
let url = candidate;
|
|
60880
60890
|
let descriptor = '';
|
|
60881
60891
|
const match = candidate.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);
|
|
@@ -60887,8 +60897,14 @@
|
|
|
60887
60897
|
descriptor = ' ' + num + suffix;
|
|
60888
60898
|
}
|
|
60889
60899
|
}
|
|
60890
|
-
|
|
60891
|
-
|
|
60900
|
+
try {
|
|
60901
|
+
const out = await options.minifyURLs(url);
|
|
60902
|
+
return (typeof out === 'string' ? out : url) + descriptor;
|
|
60903
|
+
} catch (err) {
|
|
60904
|
+
options.log && options.log(err);
|
|
60905
|
+
return url + descriptor;
|
|
60906
|
+
}
|
|
60907
|
+
}))).join(', ');
|
|
60892
60908
|
} else if (isMetaViewport(tag, attrs) && attrName === 'content') {
|
|
60893
60909
|
attrValue = attrValue.replace(/\s+/g, '').replace(/[0-9]+\.[0-9]+/g, function (numString) {
|
|
60894
60910
|
// "0.90000" -> "0.9"
|
|
@@ -61279,9 +61295,21 @@
|
|
|
61279
61295
|
const cleanCssOptions = typeof option === 'object' ? option : {};
|
|
61280
61296
|
|
|
61281
61297
|
options.minifyCSS = async function (text, type) {
|
|
61282
|
-
text =
|
|
61283
|
-
|
|
61284
|
-
|
|
61298
|
+
text = await replaceAsync(
|
|
61299
|
+
text,
|
|
61300
|
+
/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/ig,
|
|
61301
|
+
async function (match, prefix, dq, sq, unq, suffix) {
|
|
61302
|
+
const quote = dq != null ? '"' : (sq != null ? "'" : '');
|
|
61303
|
+
const url = dq ?? sq ?? unq ?? '';
|
|
61304
|
+
try {
|
|
61305
|
+
const out = await options.minifyURLs(url);
|
|
61306
|
+
return prefix + quote + (typeof out === 'string' ? out : url) + quote + suffix;
|
|
61307
|
+
} catch (err) {
|
|
61308
|
+
options.log && options.log(err);
|
|
61309
|
+
return match;
|
|
61310
|
+
}
|
|
61311
|
+
}
|
|
61312
|
+
);
|
|
61285
61313
|
|
|
61286
61314
|
const inputCSS = wrapCSS(text, type);
|
|
61287
61315
|
|
|
@@ -6,4 +6,4 @@ var ps=2147483647,ds=/[^\x20-\x7E]/,hs=/[\x2E\u3002\uFF0E\uFF61]/g,ms={overflow:
|
|
|
6
6
|
* Modified by Juriy "kangax" Zaytsev
|
|
7
7
|
* Original code by Erik Arvidsson, Mozilla Public License
|
|
8
8
|
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
|
9
|
-
*/class hE extends Set{has(e){return super.has(e.toLowerCase())}}const mE=/([^\s"'<>/=]+)/,gE=[/=/],_E=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^ \t\n\f\r"'`=<>]+)/.source],vE=function(){const e="A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7\\u04C8\\u04CB\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD\\u0EAE\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102\\u1103\\u1105-\\u1107\\u1109\\u110B\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D\\u116E\\u1172\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE\\u11AF\\u11B7\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A\\u212B\\u212E\\u2180-\\u2182\\u3007\\u3021-\\u3029\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\u4E00-\\u9FA5\\uAC00-\\uD7A3",t="["+e+"_]["+e+"0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE7-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\.\\-_\\u0300-\\u0345\\u0360\\u0361\\u0483-\\u0486\\u0591-\\u05A1\\u05A3-\\u05B9\\u05BB-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u064B-\\u0652\\u0670\\u06D6-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0901-\\u0903\\u093C\\u093E-\\u094D\\u0951-\\u0954\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u0A02\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A70\\u0A71\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B43\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B82\\u0B83\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C01-\\u0C03\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C82\\u0C83\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D43\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86-\\u0F8B\\u0F90-\\u0F95\\u0F97\\u0F99-\\u0FAD\\u0FB1-\\u0FB7\\u0FB9\\u20D0-\\u20DC\\u20E1\\u302A-\\u302F\\u3099\\u309A\\xB7\\u02D0\\u02D1\\u0387\\u0640\\u0E46\\u0EC6\\u3005\\u3031-\\u3035\\u309D\\u309E\\u30FC-\\u30FE]*";return"((?:"+t+"\\:)?"+t+")"}(),EE=new RegExp("^<"+vE),bE=/^\s*(\/?)>/,yE=new RegExp("^<\\/"+vE+"[^>]*>"),SE=/^<!DOCTYPE\s?[^>]+>/i;let AE=!1;"x".replace(/x(.)?/g,function(e,t){AE=""===t});const DE=new hE(["area","base","basefont","br","col","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),TE=new hE(["a","abbr","acronym","applet","b","basefont","bdo","big","br","button","cite","code","del","dfn","em","font","i","iframe","img","input","ins","kbd","label","map","noscript","object","q","s","samp","script","select","small","span","strike","strong","sub","sup","svg","textarea","tt","u","var"]),CE=new hE(["colgroup","dd","dt","li","option","p","td","tfoot","th","thead","tr","source"]),OE=new hE(["checked","compact","declare","defer","disabled","ismap","multiple","nohref","noresize","noshade","nowrap","readonly","selected"]),RE=new hE(["script","style"]),wE=new hE(["address","article","aside","base","blockquote","body","caption","col","colgroup","dd","details","dialog","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","menuitem","meta","ol","optgroup","option","param","rp","rt","source","style","summary","tbody","td","tfoot","th","thead","title","tr","track","ul"]),kE={};function xE(e){let t=mE.source+"(?:\\s*("+function(e){return gE.concat(e.customAttrAssign||[]).map(function(e){return"(?:"+e.source+")"}).join("|")}(e)+")[ \\t\\n\\f\\r]*(?:"+_E.join("|")+"))?";if(e.customAttrSurround){const n=[];for(let r=e.customAttrSurround.length-1;r>=0;r--)n[r]="(?:("+e.customAttrSurround[r][0].source+")\\s*"+t+"\\s*("+e.customAttrSurround[r][1].source+"))";n.push("(?:"+t+")"),t="(?:"+n.join("|")+")"}return new RegExp("^\\s*"+t)}class ME{constructor(e,t){this.html=e,this.handler=t}async parse(){let e=this.html;const t=this.handler,n=[];let r;const i=xE(t);let o,a,s;for(;e;){if(o=e,r&&RE.has(r)){const n=r.toLowerCase(),i=kE[n]||(kE[n]=new RegExp("([\\s\\S]*?)</"+n+"[^>]*>","i"));e=await dE(e,i,async(e,r)=>("script"!==n&&"style"!==n&&"noscript"!==n&&(r=r.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),t.chars&&await t.chars(r),"")),await p("</"+n+">",n)}else{let n,r=e.indexOf("<");if(0===r){if(/^<!--/.test(e)){const n=e.indexOf("--\x3e");if(n>=0){t.comment&&await t.comment(e.substring(4,n)),e=e.substring(n+3),a="";continue}}if(/^<!\[/.test(e)){const n=e.indexOf("]>");if(n>=0){t.comment&&await t.comment(e.substring(2,n+1),!0),e=e.substring(n+2),a="";continue}}const n=e.match(SE);if(n){t.doctype&&t.doctype(n[0]),e=e.substring(n[0].length),a="";continue}const i=e.match(yE);if(i){e=e.substring(i[0].length),await dE(i[0],yE,p),a="/"+i[1].toLowerCase();continue}const o=u(e);if(o){e=o.rest,await c(o),a=o.tagName.toLowerCase();continue}t.continueOnParseError&&(r=e.indexOf("<",1))}r>=0?(n=e.substring(0,r),e=e.substring(r)):(n=e,e="");let i=u(e);i?s=i.tagName:(i=e.match(yE),s=i?"/"+i[1]:""),t.chars&&await t.chars(n,a,s),a=""}if(e===o)throw new Error("Parse Error: "+e)}function u(e){const t=e.match(EE);if(t){const n={tagName:t[1],attrs:[]};let r,o;for(e=e.slice(t[0].length);!(r=e.match(bE))&&(o=e.match(i));)e=e.slice(o[0].length),n.attrs.push(o);if(r)return n.unarySlash=r[1],n.rest=e.slice(r[0].length),n}}async function l(e){if(f(e)>=0)return await p("",e),!0}async function c(e){const i=e.tagName;let o=e.unarySlash;if(t.html5&&("p"===r&&wE.has(i)?await p("",r):"tbody"===i?await l("thead"):"tfoot"===i&&(await l("tbody")||await l("thead")),"col"===i&&f("colgroup")<0&&(r="colgroup",n.push({tag:r,attrs:[]}),t.start&&await t.start(r,[],!1,""))),!t.html5&&!TE.has(i))for(;r&&TE.has(r);)await p("",r);CE.has(i)&&r===i&&await p("",i);const a=DE.has(i)||"html"===i&&"head"===r||!!o,s=e.attrs.map(function(e){let n,r,i,o,a,s;function u(t){return a=e[t],r=e[t+1],void 0!==r?'"':(r=e[t+2],void 0!==r?"'":(r=e[t+3],void 0===r&&OE.has(n)&&(r=n),""))}AE&&-1===e[0].indexOf('""')&&(""===e[3]&&delete e[3],""===e[4]&&delete e[4],""===e[5]&&delete e[5]);let l=1;if(t.customAttrSurround)for(let r=0,a=t.customAttrSurround.length;r<a;r++,l+=7)if(n=e[l+1],n){s=u(l+2),i=e[l],o=e[l+6];break}return!n&&(n=e[l])&&(s=u(l+1)),{name:n,value:r,customAssign:a||"=",customOpen:i||"",customClose:o||"",quote:s||""}});a||(n.push({tag:i,attrs:s}),r=i,o=""),t.start&&await t.start(i,s,a,o)}function f(e){let t;const r=e.toLowerCase();for(t=n.length-1;t>=0&&n[t].tag.toLowerCase()!==r;t--);return t}async function p(e,i){let o;if(o=i?f(i):0,o>=0){for(let r=n.length-1;r>=o;r--)t.end&&t.end(n[r].tag,n[r].attrs,r>o||!e);n.length=o,r=o&&n[o-1].tag}else"br"===i.toLowerCase()?t.start&&await t.start(i,[],!0,""):"p"===i.toLowerCase()&&(t.start&&await t.start(i,[],!1,"",!0),t.end&&t.end(i,[]))}t.partialMarkup||await p()}}class FE{sort(e,t=0){for(let n=0,r=this.keys.length;n<r;n++){const r=this.keys[n],i=r.slice(1);let o=e.indexOf(i,t);if(-1!==o){do{o!==t&&(e.splice(o,1),e.splice(t,0,i)),t++}while(-1!==(o=e.indexOf(i,t)));return this[r].sort(e,t)}}return e}}class NE{add(e){e.forEach(t=>{const n="$"+t;this[n]||(this[n]=[],this[n].processed=0),this[n].push(e)})}createSorter(){const e=new FE;return e.keys=Object.keys(this).sort((e,t)=>{const n=this[e].length,r=this[t].length;return n<r?1:n>r||e<t?-1:e>t?1:0}).filter(t=>{if(this[t].processed<this[t].length){const n=t.slice(1),r=new NE;return this[t].forEach(e=>{let t;for(;-1!==(t=e.indexOf(n));)e.splice(t,1);e.forEach(e=>{this["$"+e].processed++}),r.add(e.slice(0))}),e[t]=r.createSorter(),!0}return!1}),e}}const IE=e=>e&&e.replace(/^[ \n\r\t\f]+/,"").replace(/[ \n\r\t\f]+$/,"");function PE(e){return e&&e.replace(/[ \n\r\t\f\xA0]+/g,function(e){return"\t"===e?"\t":e.replace(/(^|\xA0+)[^\xA0]+/g,"$1 ")})}function LE(e,t,n,r,i){let o="",a="";return t.preserveLineBreaks&&(e=e.replace(/^[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*/,function(){return o="\n",""}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/,function(){return a="\n",""})),n&&(e=e.replace(/^[ \n\r\t\f\xA0]+/,function(e){const n=!o&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/^[^\xA0]+/,"").replace(/(\xA0+)[^\xA0]+/g,"$1 ")||(n?" ":"")})),r&&(e=e.replace(/[ \n\r\t\f\xA0]+$/,function(e){const n=!a&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/[^\xA0]+(\xA0+)/g," $1").replace(/[^\xA0]+$/,"")||(n?" ":"")})),i&&(e=PE(e)),o+e+a}const BE=["a","abbr","acronym","b","bdi","bdo","big","button","cite","code","del","dfn","em","font","i","img","input","ins","kbd","label","mark","math","meter","nobr","object","output","progress","q","rp","rt","rtc","ruby","s","samp","select","small","span","strike","strong","sub","sup","svg","textarea","time","tt","u","var","wbr"],UE=new Set(["a","abbr","acronym","b","big","del","em","font","i","ins","kbd","mark","nobr","rp","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var"]),VE=new Set(["comment","img","input","wbr"]);function KE(e,t,n,r,i,o){let a=t&&!VE.has(t);a&&!r.collapseInlineTagWhitespace&&(a="/"===t.charAt(0)?!i.has(t.slice(1)):!o.has(t));let s=n&&!VE.has(n);return s&&!r.collapseInlineTagWhitespace&&(s="/"===n.charAt(0)?!o.has(n.slice(1)):!i.has(n)),LE(e,r,a,s,t&&n)}function zE(e,t){for(let n=e.length;n--;)if(e[n].name.toLowerCase()===t)return!0;return!1}const GE=new Set(["text/javascript","text/ecmascript","text/jscript","application/javascript","application/x-javascript","application/ecmascript","module"]),HE=new Set(["module"]);function WE(e=""){return""===(e=IE(e.split(/;/,2)[0]).toLowerCase())||GE.has(e)}function XE(e=""){return""===(e=IE(e).toLowerCase())||"text/css"===e}function qE(e,t){if("style"!==e)return!1;for(let e=0,n=t.length;e<n;e++){if("type"===t[e].name.toLowerCase())return XE(t[e].value)}return!0}const YE=new Set(["allowfullscreen","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","truespeed","typemustmatch","visible"]),jE=new Set(["true","false"]);function $E(e,t,n){if("link"!==e)return!1;for(let e=0,r=t.length;e<r;e++)if("rel"===t[e].name&&t[e].value===n)return!0}const QE=new Set(["img","source"]);async function ZE(e,t,n,r,i,o){if(function(e,t){const n=t.customEventAttributes;if(n){for(let t=n.length;t--;)if(n[t].test(e))return!0;return!1}return/^on[a-z]{3,}$/.test(e)}(t,r))return n=IE(n).replace(/^javascript:\s*/i,""),r.minifyJS(n,!0);if("class"===t)return n=IE(n),n=r.sortClassName?r.sortClassName(n):PE(n);if(function(e,t){return/^(?:a|area|link|base)$/.test(t)&&"href"===e||"img"===t&&/^(?:src|longdesc|usemap)$/.test(e)||"object"===t&&/^(?:classid|codebase|data|usemap)$/.test(e)||"q"===t&&"cite"===e||"blockquote"===t&&"cite"===e||("ins"===t||"del"===t)&&"cite"===e||"form"===t&&"action"===e||"input"===t&&("src"===e||"usemap"===e)||"head"===t&&"profile"===e||"script"===t&&("src"===e||"for"===e)}(t,e))return n=IE(n),$E(e,i,"canonical")?n:r.minifyURLs(n);if(function(e,t){return/^(?:a|area|object|button)$/.test(t)&&"tabindex"===e||"input"===t&&("maxlength"===e||"tabindex"===e)||"select"===t&&("size"===e||"tabindex"===e)||"textarea"===t&&/^(?:rows|cols|tabindex)$/.test(e)||"colgroup"===t&&"span"===e||"col"===t&&"span"===e||("th"===t||"td"===t)&&("rowspan"===e||"colspan"===e)}(t,e))return IE(n);if("style"===t)return(n=IE(n))&&(/;$/.test(n)&&!/&#?[0-9a-zA-Z]+;$/.test(n)&&(n=n.replace(/\s*;$/,";")),n=await r.minifyCSS(n,"inline")),n;if(function(e,t){return"srcset"===e&&QE.has(t)}(t,e))n=IE(n).split(/\s+,\s*|\s*,\s+/).map(function(e){let t=e,n="";const i=e.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);if(i){t=t.slice(0,-i[0].length);const e=+i[1].slice(0,-1),r=i[1].slice(-1);1===e&&"x"===r||(n=" "+e+r)}return r.minifyURLs(t)+n}).join(", ");else if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("name"===t[e].name&&"viewport"===t[e].value)return!0}(e,i)&&"content"===t)n=n.replace(/\s+/g,"").replace(/[0-9]+\.[0-9]+/g,function(e){return(+e).toString()});else{if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("http-equiv"===t[e].name.toLowerCase()&&"content-security-policy"===t[e].value.toLowerCase())return!0}(e,i)&&"content"===t.toLowerCase())return PE(n);if(r.customAttrCollapse&&r.customAttrCollapse.test(t))n=IE(n.replace(/ ?[\n\r]+ ?/g,"").replace(/\s{2,}/g,r.conservativeCollapse?" ":""));else if("script"===e&&"type"===t)n=IE(n.replace(/\s*;\s*/g,";"));else{if(function(e,t,n){return"media"===n&&($E(e,t,"stylesheet")||qE(e,t))}(e,i,t))return n=IE(n),r.minifyCSS(n,"media");if("iframe"===e&&"srcdoc"===t)return function(e){return Boolean(e.collapseWhitespace||e.removeComments||e.removeOptionalTags||e.minifyJS!==Db||e.minifyCSS!==Tb||e.minifyURLs!==Db)}(r)?o(n,r,!0):n}}return n}function JE(e){return"/* clean-css ignore:start */"+e+"/* clean-css ignore:end */"}function eb(e,t){switch(t){case"inline":return"*{"+e+"}";case"media":return"@media "+e+"{a{top:0}}";default:return e}}const tb=new Set(["html","head","body","colgroup","tbody"]),nb=new Set(["html","head","body","li","dt","dd","p","rb","rt","rtc","rp","optgroup","option","colgroup","caption","thead","tbody","tfoot","tr","td","th"]),rb=new Set(["meta","link","script","style","template","noscript"]),ib=new Set(["dt","dd"]),ob=new Set(["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","menu","nav","ol","p","pre","section","table","ul"]),ab=new Set(["a","audio","del","ins","map","noscript","video"]),sb=new Set(["rb","rt","rtc","rp"]),ub=new Set(["rb","rtc","rp"]),lb=new Set(["option","optgroup"]),cb=new Set(["tbody","tfoot"]),fb=new Set(["thead","tbody","tfoot"]),pb=new Set(["td","th"]),db=new Set(["html","head","body"]),hb=new Set(["html","body"]),mb=new Set(["head","colgroup","caption"]),gb=new Set(["dt","thead"]),_b=new Set(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","menu","menuitem","meta","meter","multicol","nav","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]);const vb=new RegExp("^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$");function Eb(e,t){for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}function bb(e){return!/^(?:script|style|pre|textarea)$/.test(e)}function yb(e){return!/^(?:pre|textarea)$/.test(e)}async function Sb(e,t,n,r){const i=r.name(e.name);let o=e.value;if(r.decodeEntities&&o&&(o=Qc(o,Hc.Strict)),!(r.removeRedundantAttributes&&function(e,t,n,r){return n=n?IE(n.toLowerCase()):"","script"===e&&"language"===t&&"javascript"===n||"form"===e&&"method"===t&&"get"===n||"input"===e&&"type"===t&&"text"===n||"script"===e&&"charset"===t&&!zE(r,"src")||"a"===e&&"name"===t&&zE(r,"id")||"area"===e&&"shape"===t&&"rect"===n}(n,i,o,t)||r.removeScriptTypeAttributes&&"script"===n&&"type"===i&&WE(o)&&!function(e=""){return e=IE(e.split(/;/,2)[0]).toLowerCase(),HE.has(e)}(o)||r.removeStyleLinkTypeAttributes&&("style"===n||"link"===n)&&"type"===i&&XE(o)||(o&&(o=await ZE(n,i,o,r,t,wb)),r.removeEmptyAttributes&&function(e,t,n,r){return!(n&&!/^\s*$/.test(n))&&("function"==typeof r.removeEmptyAttributes?r.removeEmptyAttributes(t,e):"input"===e&&"value"===t||vb.test(t))}(n,i,o,r))))return r.decodeEntities&&o&&(o=o.replace(/&(#?[0-9a-zA-Z]+;)/g,"&$1")),{attr:e,name:i,value:o}}function Ab(e,t,n,r,i){const o=e.name;let a=e.value;const s=e.attr;let u,l,c=s.quote;if(void 0===a||n.removeAttributeQuotes&&!~a.indexOf(i)&&/^[^ \t\n\f\r"'`=<>]+$/.test(a))l=!r||t||/\/$/.test(a)?a+" ":a;else{if(!n.preventAttributesEscaping){if(void 0===n.quoteCharacter){c=(a.match(/'/g)||[]).length<(a.match(/"/g)||[]).length?"'":'"'}else c="'"===n.quoteCharacter?"'":'"';a='"'===c?a.replace(/"/g,"""):a.replace(/'/g,"'")}l=c+a+c,r||n.removeTagWhitespace||(l+=" ")}return void 0===a||n.collapseBooleanAttributes&&function(e,t){return YE.has(e)||"draggable"===e&&!jE.has(t)}(o.toLowerCase(),a.toLowerCase())?(u=o,r||(u+=" ")):u=o+s.customAssign+l,s.customOpen+u+s.customClose}function Db(e){return e}function Tb(e){return Promise.resolve(e)}const Cb=e=>{const t={name:function(e){return e.toLowerCase()},canCollapseWhitespace:bb,canTrimWhitespace:yb,html5:!0,ignoreCustomComments:[/^!/,/^\s*#/],ignoreCustomFragments:[/<%[\s\S]*?%>/,/<\?[\s\S]*?\?>/],includeAutoGeneratedTags:!0,log:Db,minifyCSS:Tb,minifyJS:Db,minifyURLs:Db};return Object.keys(e).forEach(function(n){const r=e[n];if("caseSensitive"===n)r&&(t.name=Db);else if("log"===n)"function"==typeof r&&(t.log=r);else if("minifyCSS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};t.minifyCSS=async function(n,r){const i=eb(n=n.replace(/(url\s*\(\s*)("|'|)(.*?)\2(\s*\))/gi,function(e,n,r,i,o){return n+r+t.minifyURLs(i)+r+o}),r);return new Promise(o=>{new Pc(e).minify(i,(e,i)=>{i.errors.length>0&&(i.errors.forEach(t.log),o(n));const a=function(e,t){let n;switch(t){case"inline":n=e.match(/^\*\{([\s\S]*)\}$/);break;case"media":n=e.match(/^@media ([\s\S]*?)\s*{[\s\S]*}$/)}return n?n[1]:e}(i.styles,r);o(a)})})}}else if("minifyJS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};e.parse={...e.parse,bare_returns:!1},t.minifyJS=async function(n,r){const i=n.match(/^\s*<!--.*/),o=i?n.slice(i[0].length).replace(/\n\s*-->\s*$/,""):n;e.parse.bare_returns=r;try{const t=await async function(e,t){const n=pE(e,t);let r,i;do{i=n.next(await r),r=i.value}while(!i.done);return i.value}(o,e);return t.code.replace(/;$/,"")}catch(e){return t.log(e),n}}}else if("minifyURLs"===n&&"function"!=typeof r){if(!r)return;let e=r;"string"==typeof r?e={site:r}:"object"!=typeof r&&(e={}),t.minifyURLs=function(n){try{return zf.relate(n,e)}catch(e){return t.log(e),n}}}else t[n]=r}),t};function Ob(e){let t;do{t=Math.random().toString(36).replace(/^0\.[0-9]*/,"")}while(~e.indexOf(t));return t}const Rb=new Set(["script","style"]);async function wb(e,t,n){if(t.maxInputLength&&e.length>t.maxInputLength)throw new Error(`Input length (${e.length}) exceeds maximum allowed length (${t.maxInputLength})`);t.collapseWhitespace&&(e=LE(e,t,!0,!0));const r=[];let i,o,a="",s="",u=[];const l=[],c=[];let f="",p="";const d=[],h=[];let m,g,_;const v=t.inlineCustomElements??[],E=(Array.isArray(v)?v:Array.from(v)).map(e=>t.name(e)),b=new Set([...UE,...E]),y=new Set([...BE,...E]);e=e.replace(/<!-- htmlmin:ignore -->([\s\S]*?)<!-- htmlmin:ignore -->/g,function(n,r){if(!m){m=Ob(e);const n=new RegExp("^"+m+"([0-9]+)$");t.ignoreCustomComments?t.ignoreCustomComments=t.ignoreCustomComments.slice():t.ignoreCustomComments=[],t.ignoreCustomComments.push(n)}const i="\x3c!--"+m+d.length+"--\x3e";return d.push(r),i});const S=t.ignoreCustomFragments.map(function(e){return e.source});if(S.length){for(let e=0;e<S.length;e++)if(/[*+]/.test(S[e])){t.log("Warning: Custom fragment contains unlimited quantifiers (* or +) which may cause ReDoS vulnerability");break}const n=t.customFragmentQuantifierLimit||200,r=`\\s{0,${n}}`,i=new RegExp(r+"(?:"+S.join("|")+"){1,"+n+"}"+r,"g");e=e.replace(i,function(n){var r;g||(g=Ob(e),_=new RegExp("(\\s*)"+g+"([0-9]+)"+g+"(\\s*)","g"),t.minifyCSS&&(t.minifyCSS=(r=t.minifyCSS,function(e,t){e=e.replace(_,function(e,t,n){const r=h[+n];return r[1]+g+n+g+r[2]});const n=[];return(new Pc).minify(eb(e,t)).warnings.forEach(function(t){const r=_.exec(t);if(r){const t=g+r[2]+g;e=e.replace(t,JE(t)),n.push(t)}}),r(e,t).then(e=>(n.forEach(function(t){e=e.replace(JE(t),t)}),e))})),t.minifyJS&&(t.minifyJS=function(e){return function(t,n){return e(t.replace(_,function(e,t,n){const r=h[+n];return r[1]+g+n+g+r[2]}),n)}}(t.minifyJS)));const i=g+h.length+g;return h.push(/^(\s*)[\s\S]*?(\s*)$/.exec(n)),"\t"+i+"\t"})}function A(e,n){return t.canTrimWhitespace(e,n,yb)}function D(){let e=r.length-1;for(;e>0&&!/^<[^/!]/.test(r[e]);)e--;r.length=Math.max(0,e)}function T(){let e=r.length-1;for(;e>0&&!/^<\//.test(r[e]);)e--;r.length=Math.max(0,e)}function C(e,n){for(let i=null;e>=0&&A(i);e--){const o=r[e],a=o.match(/^<\/([\w:-]+)>$/);if(a)i=a[1];else if(/>$/.test(o)||(r[e]=KE(o,null,n,t,y,b)))break}}function O(e){let t=r.length-1;if(r.length>1){const e=r[r.length-1];/^(?:<!|$)/.test(e)&&-1===e.indexOf(m)&&t--}C(t,e)}(t.sortAttributes&&"function"!=typeof t.sortAttributes||t.sortClassName&&"function"!=typeof t.sortClassName)&&await async function(e,t,n,r){const i=t.sortAttributes&&Object.create(null),o=t.sortClassName&&new NE;function a(e){return e.map(function(e){return t.name(e.name)})}function s(e,t){return!t||-1===e.indexOf(t)}function u(e){return s(e,n)&&s(e,r)}const l=t.log;if(t.log=Db,t.sortAttributes=!1,t.sortClassName=!1,await async function e(n){let r,s;const l=new ME(n,{start:function(e,n){i&&(i[e]||(i[e]=new NE),i[e].add(a(n).filter(u)));for(let i=0,a=n.length;i<a;i++){const a=n[i];o&&a.value&&"class"===t.name(a.name)?o.add(IE(a.value).split(/[ \t\n\f\r]+/).filter(u)):t.processScripts&&"type"===a.name.toLowerCase()&&(r=e,s=a.value)}},end:function(){r=""},chars:async function(n){t.processScripts&&Rb.has(r)&&t.processScripts.indexOf(s)>-1&&await e(n)}});await l.parse()}(await wb(e,t)),t.log=l,i){const e=Object.create(null);for(const t in i)e[t]=i[t].createSorter();t.sortAttributes=function(t,n){const r=e[t];if(r){const e=Object.create(null),t=a(n);t.forEach(function(t,r){(e[t]||(e[t]=[])).push(n[r])}),r.sort(t).forEach(function(t,r){n[r]=e[t].shift()})}}}if(o){const e=o.createSorter();t.sortClassName=function(t){return e.sort(t.split(/[ \n\f\r]+/)).join(" ")}}}(e,t,m,g);const R=new ME(e,{partialMarkup:n,continueOnParseError:t.continueOnParseError,customAttrAssign:t.customAttrAssign,customAttrSurround:t.customAttrSurround,html5:t.html5,start:async function(e,n,d,h,m){"svg"===e.toLowerCase()&&((t=Object.create(t)).caseSensitive=!0,t.keepClosingSlash=!0,t.name=Db),e=t.name(e),s=e,i=e,b.has(e)||(a=""),o=!1,u=n;let _=t.removeOptionalTags;if(_){const t=_b.has(e);t&&function(e,t){switch(e){case"html":case"head":return!0;case"body":return!rb.has(t);case"colgroup":return"col"===t;case"tbody":return"tr"===t}return!1}(f,e)&&D(),f="",t&&function(e,t){switch(e){case"html":case"head":case"body":case"colgroup":case"caption":return!0;case"li":case"optgroup":case"tr":return t===e;case"dt":case"dd":return ib.has(t);case"p":return ob.has(t);case"rb":case"rt":case"rp":return sb.has(t);case"rtc":return ub.has(t);case"option":return lb.has(t);case"thead":case"tbody":return cb.has(t);case"tfoot":return"tbody"===t;case"td":case"th":return pb.has(t)}return!1}(p,e)&&(T(),_=!function(e,t){switch(t){case"colgroup":return"colgroup"===e;case"tbody":return fb.has(e)}return!1}(p,e)),p=""}t.collapseWhitespace&&(l.length||O(e),d||(A(e,n)&&!l.length||l.push(e),function(e,n){return t.canCollapseWhitespace(e,n,bb)}(e,n)&&!c.length||c.push(e)));const v="<"+e,E=h&&t.keepClosingSlash;r.push(v),t.sortAttributes&&t.sortAttributes(e,n);const y=[];for(let r=n.length,i=!0;--r>=0;){const o=await Sb(n[r],n,e,t);o&&(y.unshift(Ab(o,E,t,i,g)),i=!1)}y.length>0?(r.push(" "),r.push.apply(r,y)):_&&tb.has(e)&&(f=e),r.push(r.pop()+(E?"/":"")+">"),m&&!t.includeAutoGeneratedTags&&(D(),f="")},end:function(e,n,u){"svg"===e.toLowerCase()&&(t=Object.getPrototypeOf(t)),e=t.name(e),t.collapseWhitespace&&(l.length?e===l[l.length-1]&&l.pop():O("/"+e),c.length&&e===c[c.length-1]&&c.pop());let d=!1;e===s&&(s="",d=!o),t.removeOptionalTags&&(d&&db.has(f)&&D(),f="",!_b.has(e)||!p||gb.has(p)||"p"===p&&ab.has(e)||T(),p=nb.has(e)?e:""),t.removeEmptyElements&&d&&function(e,t){switch(e){case"textarea":return!1;case"audio":case"script":case"video":if(Eb("src",t))return!1;break;case"iframe":if(Eb("src",t)||Eb("srcdoc",t))return!1;break;case"object":if(Eb("data",t))return!1;break;case"applet":if(Eb("code",t))return!1}return!0}(e,n)?(D(),f="",p=""):(u&&!t.includeAutoGeneratedTags?p="":r.push("</"+e+">"),i="/"+e,y.has(e)?d&&(a+="|"):a="")},chars:async function(e,n,d){if(n=""===n?"comment":n,d=""===d?"comment":d,t.decodeEntities&&e&&!Rb.has(s)&&(e=function(e,t=Hc.Legacy){return Qc(e,t)}(e)),t.collapseWhitespace){if(!l.length){if("comment"===n){const o=r[r.length-1];if(-1===o.indexOf(m)&&(o||(n=i),r.length>1&&(!o||!t.conservativeCollapse&&/ $/.test(a)))){const t=r.length-2;r[t]=r[t].replace(/\s+$/,function(t){return e=t+e,""})}}if(n)if("/nobr"===n||"wbr"===n){if(/^\s/.test(e)){let e=r.length-1;for(;e>0&&0!==r[e].lastIndexOf("<"+n);)e--;C(e-1,"br")}}else b.has("/"===n.charAt(0)?n.slice(1):n)&&(e=LE(e,t,/(?:^|\s)$/.test(a)));!(e=n||d?KE(e,n,d,t,y,b):LE(e,t,!0,!0))&&/\s$/.test(a)&&n&&"/"===n.charAt(0)&&C(r.length-1,d)}c.length||"html"===d||n&&d||(e=LE(e,t,!1,!1,!0))}t.processScripts&&Rb.has(s)&&(e=await async function(e,t,n){for(let r=0,i=n.length;r<i;r++)if("type"===n[r].name.toLowerCase()&&t.processScripts.indexOf(n[r].value)>-1)return await wb(e,t);return e}(e,t,u)),function(e,t){if("script"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("type"===t[e].name.toLowerCase())return WE(t[e].value);return!0}(s,u)&&(e=await t.minifyJS(e)),qE(s,u)&&(e=await t.minifyCSS(e)),t.removeOptionalTags&&e&&(("html"===f||"body"===f&&!/^\s/.test(e))&&D(),f="",(hb.has(p)||mb.has(p)&&!/^\s/.test(e))&&T(),p=""),i=/^\s*$/.test(e)?n:"comment",t.decodeEntities&&e&&!Rb.has(s)&&(e=e.replace(/&((?:Iacute|aacute|uacute|plusmn|Otilde|otilde|agrave|Agrave|Yacute|yacute|Oslash|oslash|atilde|Atilde|brvbar|ccedil|Ccedil|Ograve|curren|divide|eacute|Eacute|ograve|Oacute|egrave|Egrave|Ugrave|frac12|frac14|frac34|ugrave|oacute|iacute|Ntilde|ntilde|Uacute|middot|igrave|Igrave|iquest|Aacute|cedil|laquo|micro|iexcl|Icirc|icirc|acirc|Ucirc|Ecirc|ocirc|Ocirc|ecirc|ucirc|Aring|aring|AElig|aelig|acute|pound|raquo|Acirc|times|THORN|szlig|thorn|COPY|auml|ordf|ordm|Uuml|macr|uuml|Auml|ouml|Ouml|para|nbsp|euml|quot|QUOT|Euml|yuml|cent|sect|copy|sup1|sup2|sup3|iuml|Iuml|ETH|shy|reg|not|yen|amp|AMP|REG|uml|eth|deg|gt|GT|LT|lt)(?!;)|(?:#?[0-9a-zA-Z]+;))/g,"&$1").replace(/</g,"<")),_&&t.collapseWhitespace&&l.length&&(e=e.replace(_,function(e,t,n){return h[+n][0]})),a+=e,e&&(o=!0),r.push(e)},comment:async function(e,n){const i=n?"<!":"\x3c!--",o=n?">":"--\x3e";e=function(e){return/^\[if\s[^\]]+]|\[endif]$/.test(e)}(e)?i+await async function(e,t){return t.processConditionalComments?await dE(e,/^(\[if\s[^\]]+]>)([\s\S]*?)(<!\[endif])$/,async function(e,n,r,i){return n+await wb(r,t,!0)+i}):e}(e,t)+o:t.removeComments?function(e,t){for(let n=0,r=t.ignoreCustomComments.length;n<r;n++)if(t.ignoreCustomComments[n].test(e))return!0;return!1}(e,t)?"\x3c!--"+e+"--\x3e":"":i+e+o,t.removeOptionalTags&&e&&(f="",p=""),r.push(e)},doctype:function(e){r.push(t.useShortDoctype?"<!doctype"+(t.removeTagWhitespace?"":" ")+"html>":PE(e))}});return await R.parse(),t.removeOptionalTags&&(db.has(f)&&D(),p&&!gb.has(p)&&T()),t.collapseWhitespace&&O("br"),function(e,t,n,r){let i;const o=t.maxLineLength,a=t.noNewlinesBeforeTagClose;if(o){let t="";const s=[];for(;e.length;){const i=t.length,u=e[0].indexOf("\n"),l=Boolean(e[0].match(yE)),c=a&&l;u<0?t+=r(n(e.shift())):(t+=r(n(e[0].slice(0,u))),e[0]=e[0].slice(u+1)),i>0&&t.length>o&&!c?(s.push(t.slice(0,i)),t=t.slice(i)):u>=0&&(s.push(t),t="")}t&&s.push(t),i=s.join("\n")}else i=r(n(e.join("")));return t.collapseWhitespace?LE(i,t,!0,!0):i}(r,t,_?function(e){return e.replace(_,function(e,n,r,i){let o=h[+r][0];return t.collapseWhitespace?("\t"!==n&&(o=n+o),"\t"!==i&&(o+=i),LE(o,{preserveLineBreaks:t.preserveLineBreaks,conservativeCollapse:!t.trimCustomFragments},/^[ \n\r\t\f]/.test(o),/[ \n\r\t\f]$/.test(o))):o})}:Db,m?function(e){return e.replace(new RegExp("\x3c!--"+m+"([0-9]+)--\x3e","g"),function(e,t){return d[+t]})}:Db)}const kb=async function(e,t){const n=Date.now();t=Cb(t||{});const r=await wb(e,t);return t.log("minified in: "+(Date.now()-n)+"ms"),r};var xb={minify:kb};e.default=xb,e.minify=kb,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
|
+
*/class hE extends Set{has(e){return super.has(e.toLowerCase())}}const mE=/([^\s"'<>/=]+)/,gE=[/=/],_E=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^ \t\n\f\r"'`=<>]+)/.source],vE=function(){const e="A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7\\u04C8\\u04CB\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD\\u0EAE\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102\\u1103\\u1105-\\u1107\\u1109\\u110B\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D\\u116E\\u1172\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE\\u11AF\\u11B7\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A\\u212B\\u212E\\u2180-\\u2182\\u3007\\u3021-\\u3029\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\u4E00-\\u9FA5\\uAC00-\\uD7A3",t="["+e+"_]["+e+"0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE7-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\.\\-_\\u0300-\\u0345\\u0360\\u0361\\u0483-\\u0486\\u0591-\\u05A1\\u05A3-\\u05B9\\u05BB-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u064B-\\u0652\\u0670\\u06D6-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0901-\\u0903\\u093C\\u093E-\\u094D\\u0951-\\u0954\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u0A02\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A70\\u0A71\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B43\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B82\\u0B83\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C01-\\u0C03\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C82\\u0C83\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D43\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86-\\u0F8B\\u0F90-\\u0F95\\u0F97\\u0F99-\\u0FAD\\u0FB1-\\u0FB7\\u0FB9\\u20D0-\\u20DC\\u20E1\\u302A-\\u302F\\u3099\\u309A\\xB7\\u02D0\\u02D1\\u0387\\u0640\\u0E46\\u0EC6\\u3005\\u3031-\\u3035\\u309D\\u309E\\u30FC-\\u30FE]*";return"((?:"+t+"\\:)?"+t+")"}(),EE=new RegExp("^<"+vE),bE=/^\s*(\/?)>/,yE=new RegExp("^<\\/"+vE+"[^>]*>"),SE=/^<!DOCTYPE\s?[^>]+>/i;let AE=!1;"x".replace(/x(.)?/g,function(e,t){AE=""===t});const DE=new hE(["area","base","basefont","br","col","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),TE=new hE(["a","abbr","acronym","applet","b","basefont","bdo","big","br","button","cite","code","del","dfn","em","font","i","iframe","img","input","ins","kbd","label","map","noscript","object","q","s","samp","script","select","small","span","strike","strong","sub","sup","svg","textarea","tt","u","var"]),CE=new hE(["colgroup","dd","dt","li","option","p","td","tfoot","th","thead","tr","source"]),OE=new hE(["checked","compact","declare","defer","disabled","ismap","multiple","nohref","noresize","noshade","nowrap","readonly","selected"]),RE=new hE(["script","style"]),wE=new hE(["address","article","aside","base","blockquote","body","caption","col","colgroup","dd","details","dialog","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","menuitem","meta","ol","optgroup","option","param","rp","rt","source","style","summary","tbody","td","tfoot","th","thead","title","tr","track","ul"]),kE={};function xE(e){let t=mE.source+"(?:\\s*("+function(e){return gE.concat(e.customAttrAssign||[]).map(function(e){return"(?:"+e.source+")"}).join("|")}(e)+")[ \\t\\n\\f\\r]*(?:"+_E.join("|")+"))?";if(e.customAttrSurround){const n=[];for(let r=e.customAttrSurround.length-1;r>=0;r--)n[r]="(?:("+e.customAttrSurround[r][0].source+")\\s*"+t+"\\s*("+e.customAttrSurround[r][1].source+"))";n.push("(?:"+t+")"),t="(?:"+n.join("|")+")"}return new RegExp("^\\s*"+t)}class ME{constructor(e,t){this.html=e,this.handler=t}async parse(){let e=this.html;const t=this.handler,n=[];let r;const i=xE(t);let o,a,s;for(;e;){if(o=e,r&&RE.has(r)){const n=r.toLowerCase(),i=kE[n]||(kE[n]=new RegExp("([\\s\\S]*?)</"+n+"[^>]*>","i"));e=await dE(e,i,async(e,r)=>("script"!==n&&"style"!==n&&"noscript"!==n&&(r=r.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),t.chars&&await t.chars(r),"")),await p("</"+n+">",n)}else{let n,r=e.indexOf("<");if(0===r){if(/^<!--/.test(e)){const n=e.indexOf("--\x3e");if(n>=0){t.comment&&await t.comment(e.substring(4,n)),e=e.substring(n+3),a="";continue}}if(/^<!\[/.test(e)){const n=e.indexOf("]>");if(n>=0){t.comment&&await t.comment(e.substring(2,n+1),!0),e=e.substring(n+2),a="";continue}}const n=e.match(SE);if(n){t.doctype&&t.doctype(n[0]),e=e.substring(n[0].length),a="";continue}const i=e.match(yE);if(i){e=e.substring(i[0].length),await dE(i[0],yE,p),a="/"+i[1].toLowerCase();continue}const o=u(e);if(o){e=o.rest,await c(o),a=o.tagName.toLowerCase();continue}t.continueOnParseError&&(r=e.indexOf("<",1))}r>=0?(n=e.substring(0,r),e=e.substring(r)):(n=e,e="");let i=u(e);i?s=i.tagName:(i=e.match(yE),s=i?"/"+i[1]:""),t.chars&&await t.chars(n,a,s),a=""}if(e===o)throw new Error("Parse Error: "+e)}function u(e){const t=e.match(EE);if(t){const n={tagName:t[1],attrs:[]};let r,o;for(e=e.slice(t[0].length);!(r=e.match(bE))&&(o=e.match(i));)e=e.slice(o[0].length),n.attrs.push(o);if(r)return n.unarySlash=r[1],n.rest=e.slice(r[0].length),n}}async function l(e){if(f(e)>=0)return await p("",e),!0}async function c(e){const i=e.tagName;let o=e.unarySlash;if(t.html5&&("p"===r&&wE.has(i)?await p("",r):"tbody"===i?await l("thead"):"tfoot"===i&&(await l("tbody")||await l("thead")),"col"===i&&f("colgroup")<0&&(r="colgroup",n.push({tag:r,attrs:[]}),t.start&&await t.start(r,[],!1,""))),!t.html5&&!TE.has(i))for(;r&&TE.has(r);)await p("",r);CE.has(i)&&r===i&&await p("",i);const a=DE.has(i)||"html"===i&&"head"===r||!!o,s=e.attrs.map(function(e){let n,r,i,o,a,s;function u(t){return a=e[t],r=e[t+1],void 0!==r?'"':(r=e[t+2],void 0!==r?"'":(r=e[t+3],void 0===r&&OE.has(n)&&(r=n),""))}AE&&-1===e[0].indexOf('""')&&(""===e[3]&&delete e[3],""===e[4]&&delete e[4],""===e[5]&&delete e[5]);let l=1;if(t.customAttrSurround)for(let r=0,a=t.customAttrSurround.length;r<a;r++,l+=7)if(n=e[l+1],n){s=u(l+2),i=e[l],o=e[l+6];break}return!n&&(n=e[l])&&(s=u(l+1)),{name:n,value:r,customAssign:a||"=",customOpen:i||"",customClose:o||"",quote:s||""}});a||(n.push({tag:i,attrs:s}),r=i,o=""),t.start&&await t.start(i,s,a,o)}function f(e){let t;const r=e.toLowerCase();for(t=n.length-1;t>=0&&n[t].tag.toLowerCase()!==r;t--);return t}async function p(e,i){let o;if(o=i?f(i):0,o>=0){for(let r=n.length-1;r>=o;r--)t.end&&t.end(n[r].tag,n[r].attrs,r>o||!e);n.length=o,r=o&&n[o-1].tag}else"br"===i.toLowerCase()?t.start&&await t.start(i,[],!0,""):"p"===i.toLowerCase()&&(t.start&&await t.start(i,[],!1,"",!0),t.end&&t.end(i,[]))}t.partialMarkup||await p()}}class FE{sort(e,t=0){for(let n=0,r=this.keys.length;n<r;n++){const r=this.keys[n],i=r.slice(1);let o=e.indexOf(i,t);if(-1!==o){do{o!==t&&(e.splice(o,1),e.splice(t,0,i)),t++}while(-1!==(o=e.indexOf(i,t)));return this[r].sort(e,t)}}return e}}class NE{add(e){e.forEach(t=>{const n="$"+t;this[n]||(this[n]=[],this[n].processed=0),this[n].push(e)})}createSorter(){const e=new FE;return e.keys=Object.keys(this).sort((e,t)=>{const n=this[e].length,r=this[t].length;return n<r?1:n>r||e<t?-1:e>t?1:0}).filter(t=>{if(this[t].processed<this[t].length){const n=t.slice(1),r=new NE;return this[t].forEach(e=>{let t;for(;-1!==(t=e.indexOf(n));)e.splice(t,1);e.forEach(e=>{this["$"+e].processed++}),r.add(e.slice(0))}),e[t]=r.createSorter(),!0}return!1}),e}}const IE=e=>e&&e.replace(/^[ \n\r\t\f]+/,"").replace(/[ \n\r\t\f]+$/,"");function PE(e){return e&&e.replace(/[ \n\r\t\f\xA0]+/g,function(e){return"\t"===e?"\t":e.replace(/(^|\xA0+)[^\xA0]+/g,"$1 ")})}function LE(e,t,n,r,i){let o="",a="";return t.preserveLineBreaks&&(e=e.replace(/^[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*/,function(){return o="\n",""}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/,function(){return a="\n",""})),n&&(e=e.replace(/^[ \n\r\t\f\xA0]+/,function(e){const n=!o&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/^[^\xA0]+/,"").replace(/(\xA0+)[^\xA0]+/g,"$1 ")||(n?" ":"")})),r&&(e=e.replace(/[ \n\r\t\f\xA0]+$/,function(e){const n=!a&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/[^\xA0]+(\xA0+)/g," $1").replace(/[^\xA0]+$/,"")||(n?" ":"")})),i&&(e=PE(e)),o+e+a}const BE=["a","abbr","acronym","b","bdi","bdo","big","button","cite","code","del","dfn","em","font","i","img","input","ins","kbd","label","mark","math","meter","nobr","object","output","progress","q","rp","rt","rtc","ruby","s","samp","select","small","span","strike","strong","sub","sup","svg","textarea","time","tt","u","var","wbr"],UE=new Set(["a","abbr","acronym","b","big","del","em","font","i","ins","kbd","mark","nobr","rp","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var"]),VE=new Set(["comment","img","input","wbr"]);function KE(e,t,n,r,i,o){let a=t&&!VE.has(t);a&&!r.collapseInlineTagWhitespace&&(a="/"===t.charAt(0)?!i.has(t.slice(1)):!o.has(t));let s=n&&!VE.has(n);return s&&!r.collapseInlineTagWhitespace&&(s="/"===n.charAt(0)?!o.has(n.slice(1)):!i.has(n)),LE(e,r,a,s,t&&n)}function zE(e,t){for(let n=e.length;n--;)if(e[n].name.toLowerCase()===t)return!0;return!1}const GE=new Set(["text/javascript","text/ecmascript","text/jscript","application/javascript","application/x-javascript","application/ecmascript","module"]),HE=new Set(["module"]);function WE(e=""){return""===(e=IE(e.split(/;/,2)[0]).toLowerCase())||GE.has(e)}function XE(e=""){return""===(e=IE(e).toLowerCase())||"text/css"===e}function qE(e,t){if("style"!==e)return!1;for(let e=0,n=t.length;e<n;e++){if("type"===t[e].name.toLowerCase())return XE(t[e].value)}return!0}const YE=new Set(["allowfullscreen","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","truespeed","typemustmatch","visible"]),jE=new Set(["true","false"]);function $E(e,t,n){if("link"!==e)return!1;const r=String(n).toLowerCase();for(let e=0;e<t.length;e++)if("rel"===t[e].name.toLowerCase()){if(String(t[e].value).toLowerCase().split(/\s+/).includes(r))return!0}return!1}const QE=new Set(["img","source"]);async function ZE(e,t,n,r,i,o){if(function(e,t){const n=t.customEventAttributes;if(n){for(let t=n.length;t--;)if(n[t].test(e))return!0;return!1}return/^on[a-z]{3,}$/.test(e)}(t,r))return n=IE(n).replace(/^javascript:\s*/i,""),r.minifyJS(n,!0);if("class"===t)return n=IE(n),n=r.sortClassName?r.sortClassName(n):PE(n);if(function(e,t){return/^(?:a|area|link|base)$/.test(t)&&"href"===e||"img"===t&&/^(?:src|longdesc|usemap)$/.test(e)||"object"===t&&/^(?:classid|codebase|data|usemap)$/.test(e)||"q"===t&&"cite"===e||"blockquote"===t&&"cite"===e||("ins"===t||"del"===t)&&"cite"===e||"form"===t&&"action"===e||"input"===t&&("src"===e||"usemap"===e)||"head"===t&&"profile"===e||"script"===t&&("src"===e||"for"===e)}(t,e)){if(n=IE(n),$E(e,i,"canonical"))return n;try{const e=await r.minifyURLs(n);return"string"==typeof e?e:n}catch(e){return r.log&&r.log(e),n}}else{if(function(e,t){return/^(?:a|area|object|button)$/.test(t)&&"tabindex"===e||"input"===t&&("maxlength"===e||"tabindex"===e)||"select"===t&&("size"===e||"tabindex"===e)||"textarea"===t&&/^(?:rows|cols|tabindex)$/.test(e)||"colgroup"===t&&"span"===e||"col"===t&&"span"===e||("th"===t||"td"===t)&&("rowspan"===e||"colspan"===e)}(t,e))return IE(n);if("style"===t)return(n=IE(n))&&(/;$/.test(n)&&!/&#?[0-9a-zA-Z]+;$/.test(n)&&(n=n.replace(/\s*;$/,";")),n=await r.minifyCSS(n,"inline")),n;if(function(e,t){return"srcset"===e&&QE.has(t)}(t,e))n=(await Promise.all(IE(n).split(/\s+,\s*|\s*,\s+/).map(async function(e){let t=e,n="";const i=e.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);if(i){t=t.slice(0,-i[0].length);const e=+i[1].slice(0,-1),r=i[1].slice(-1);1===e&&"x"===r||(n=" "+e+r)}try{const e=await r.minifyURLs(t);return("string"==typeof e?e:t)+n}catch(e){return r.log&&r.log(e),t+n}}))).join(", ");else if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("name"===t[e].name&&"viewport"===t[e].value)return!0}(e,i)&&"content"===t)n=n.replace(/\s+/g,"").replace(/[0-9]+\.[0-9]+/g,function(e){return(+e).toString()});else{if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("http-equiv"===t[e].name.toLowerCase()&&"content-security-policy"===t[e].value.toLowerCase())return!0}(e,i)&&"content"===t.toLowerCase())return PE(n);if(r.customAttrCollapse&&r.customAttrCollapse.test(t))n=IE(n.replace(/ ?[\n\r]+ ?/g,"").replace(/\s{2,}/g,r.conservativeCollapse?" ":""));else if("script"===e&&"type"===t)n=IE(n.replace(/\s*;\s*/g,";"));else{if(function(e,t,n){return"media"===n&&($E(e,t,"stylesheet")||qE(e,t))}(e,i,t))return n=IE(n),r.minifyCSS(n,"media");if("iframe"===e&&"srcdoc"===t)return function(e){return Boolean(e.collapseWhitespace||e.removeComments||e.removeOptionalTags||e.minifyJS!==Db||e.minifyCSS!==Tb||e.minifyURLs!==Db)}(r)?o(n,r,!0):n}}}return n}function JE(e){return"/* clean-css ignore:start */"+e+"/* clean-css ignore:end */"}function eb(e,t){switch(t){case"inline":return"*{"+e+"}";case"media":return"@media "+e+"{a{top:0}}";default:return e}}const tb=new Set(["html","head","body","colgroup","tbody"]),nb=new Set(["html","head","body","li","dt","dd","p","rb","rt","rtc","rp","optgroup","option","colgroup","caption","thead","tbody","tfoot","tr","td","th"]),rb=new Set(["meta","link","script","style","template","noscript"]),ib=new Set(["dt","dd"]),ob=new Set(["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","menu","nav","ol","p","pre","section","table","ul"]),ab=new Set(["a","audio","del","ins","map","noscript","video"]),sb=new Set(["rb","rt","rtc","rp"]),ub=new Set(["rb","rtc","rp"]),lb=new Set(["option","optgroup"]),cb=new Set(["tbody","tfoot"]),fb=new Set(["thead","tbody","tfoot"]),pb=new Set(["td","th"]),db=new Set(["html","head","body"]),hb=new Set(["html","body"]),mb=new Set(["head","colgroup","caption"]),gb=new Set(["dt","thead"]),_b=new Set(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","menu","menuitem","meta","meter","multicol","nav","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]);const vb=new RegExp("^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$");function Eb(e,t){for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}function bb(e){return!/^(?:script|style|pre|textarea)$/.test(e)}function yb(e){return!/^(?:pre|textarea)$/.test(e)}async function Sb(e,t,n,r){const i=r.name(e.name);let o=e.value;if(r.decodeEntities&&o&&(o=Qc(o,Hc.Strict)),!(r.removeRedundantAttributes&&function(e,t,n,r){return n=n?IE(n.toLowerCase()):"","script"===e&&"language"===t&&"javascript"===n||"form"===e&&"method"===t&&"get"===n||"input"===e&&"type"===t&&"text"===n||"script"===e&&"charset"===t&&!zE(r,"src")||"a"===e&&"name"===t&&zE(r,"id")||"area"===e&&"shape"===t&&"rect"===n}(n,i,o,t)||r.removeScriptTypeAttributes&&"script"===n&&"type"===i&&WE(o)&&!function(e=""){return e=IE(e.split(/;/,2)[0]).toLowerCase(),HE.has(e)}(o)||r.removeStyleLinkTypeAttributes&&("style"===n||"link"===n)&&"type"===i&&XE(o)||(o&&(o=await ZE(n,i,o,r,t,wb)),r.removeEmptyAttributes&&function(e,t,n,r){return!(n&&!/^\s*$/.test(n))&&("function"==typeof r.removeEmptyAttributes?r.removeEmptyAttributes(t,e):"input"===e&&"value"===t||vb.test(t))}(n,i,o,r))))return r.decodeEntities&&o&&(o=o.replace(/&(#?[0-9a-zA-Z]+;)/g,"&$1")),{attr:e,name:i,value:o}}function Ab(e,t,n,r,i){const o=e.name;let a=e.value;const s=e.attr;let u,l,c=s.quote;if(void 0===a||n.removeAttributeQuotes&&!~a.indexOf(i)&&/^[^ \t\n\f\r"'`=<>]+$/.test(a))l=!r||t||/\/$/.test(a)?a+" ":a;else{if(!n.preventAttributesEscaping){if(void 0===n.quoteCharacter){c=(a.match(/'/g)||[]).length<(a.match(/"/g)||[]).length?"'":'"'}else c="'"===n.quoteCharacter?"'":'"';a='"'===c?a.replace(/"/g,"""):a.replace(/'/g,"'")}l=c+a+c,r||n.removeTagWhitespace||(l+=" ")}return void 0===a||n.collapseBooleanAttributes&&function(e,t){return YE.has(e)||"draggable"===e&&!jE.has(t)}(o.toLowerCase(),a.toLowerCase())?(u=o,r||(u+=" ")):u=o+s.customAssign+l,s.customOpen+u+s.customClose}function Db(e){return e}function Tb(e){return Promise.resolve(e)}const Cb=e=>{const t={name:function(e){return e.toLowerCase()},canCollapseWhitespace:bb,canTrimWhitespace:yb,html5:!0,ignoreCustomComments:[/^!/,/^\s*#/],ignoreCustomFragments:[/<%[\s\S]*?%>/,/<\?[\s\S]*?\?>/],includeAutoGeneratedTags:!0,log:Db,minifyCSS:Tb,minifyJS:Db,minifyURLs:Db};return Object.keys(e).forEach(function(n){const r=e[n];if("caseSensitive"===n)r&&(t.name=Db);else if("log"===n)"function"==typeof r&&(t.log=r);else if("minifyCSS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};t.minifyCSS=async function(n,r){const i=eb(n=await dE(n,/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/gi,async function(e,n,r,i,o,a){const s=null!=r?'"':null!=i?"'":"",u=r??i??o??"";try{const e=await t.minifyURLs(u);return n+s+("string"==typeof e?e:u)+s+a}catch(n){return t.log&&t.log(n),e}}),r);return new Promise(o=>{new Pc(e).minify(i,(e,i)=>{i.errors.length>0&&(i.errors.forEach(t.log),o(n));const a=function(e,t){let n;switch(t){case"inline":n=e.match(/^\*\{([\s\S]*)\}$/);break;case"media":n=e.match(/^@media ([\s\S]*?)\s*{[\s\S]*}$/)}return n?n[1]:e}(i.styles,r);o(a)})})}}else if("minifyJS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};e.parse={...e.parse,bare_returns:!1},t.minifyJS=async function(n,r){const i=n.match(/^\s*<!--.*/),o=i?n.slice(i[0].length).replace(/\n\s*-->\s*$/,""):n;e.parse.bare_returns=r;try{const t=await async function(e,t){const n=pE(e,t);let r,i;do{i=n.next(await r),r=i.value}while(!i.done);return i.value}(o,e);return t.code.replace(/;$/,"")}catch(e){return t.log(e),n}}}else if("minifyURLs"===n&&"function"!=typeof r){if(!r)return;let e=r;"string"==typeof r?e={site:r}:"object"!=typeof r&&(e={}),t.minifyURLs=function(n){try{return zf.relate(n,e)}catch(e){return t.log(e),n}}}else t[n]=r}),t};function Ob(e){let t;do{t=Math.random().toString(36).replace(/^0\.[0-9]*/,"")}while(~e.indexOf(t));return t}const Rb=new Set(["script","style"]);async function wb(e,t,n){if(t.maxInputLength&&e.length>t.maxInputLength)throw new Error(`Input length (${e.length}) exceeds maximum allowed length (${t.maxInputLength})`);t.collapseWhitespace&&(e=LE(e,t,!0,!0));const r=[];let i,o,a="",s="",u=[];const l=[],c=[];let f="",p="";const d=[],h=[];let m,g,_;const v=t.inlineCustomElements??[],E=(Array.isArray(v)?v:Array.from(v)).map(e=>t.name(e)),b=new Set([...UE,...E]),y=new Set([...BE,...E]);e=e.replace(/<!-- htmlmin:ignore -->([\s\S]*?)<!-- htmlmin:ignore -->/g,function(n,r){if(!m){m=Ob(e);const n=new RegExp("^"+m+"([0-9]+)$");t.ignoreCustomComments?t.ignoreCustomComments=t.ignoreCustomComments.slice():t.ignoreCustomComments=[],t.ignoreCustomComments.push(n)}const i="\x3c!--"+m+d.length+"--\x3e";return d.push(r),i});const S=t.ignoreCustomFragments.map(function(e){return e.source});if(S.length){for(let e=0;e<S.length;e++)if(/[*+]/.test(S[e])){t.log("Warning: Custom fragment contains unlimited quantifiers (* or +) which may cause ReDoS vulnerability");break}const n=t.customFragmentQuantifierLimit||200,r=`\\s{0,${n}}`,i=new RegExp(r+"(?:"+S.join("|")+"){1,"+n+"}"+r,"g");e=e.replace(i,function(n){var r;g||(g=Ob(e),_=new RegExp("(\\s*)"+g+"([0-9]+)"+g+"(\\s*)","g"),t.minifyCSS&&(t.minifyCSS=(r=t.minifyCSS,function(e,t){e=e.replace(_,function(e,t,n){const r=h[+n];return r[1]+g+n+g+r[2]});const n=[];return(new Pc).minify(eb(e,t)).warnings.forEach(function(t){const r=_.exec(t);if(r){const t=g+r[2]+g;e=e.replace(t,JE(t)),n.push(t)}}),r(e,t).then(e=>(n.forEach(function(t){e=e.replace(JE(t),t)}),e))})),t.minifyJS&&(t.minifyJS=function(e){return function(t,n){return e(t.replace(_,function(e,t,n){const r=h[+n];return r[1]+g+n+g+r[2]}),n)}}(t.minifyJS)));const i=g+h.length+g;return h.push(/^(\s*)[\s\S]*?(\s*)$/.exec(n)),"\t"+i+"\t"})}function A(e,n){return t.canTrimWhitespace(e,n,yb)}function D(){let e=r.length-1;for(;e>0&&!/^<[^/!]/.test(r[e]);)e--;r.length=Math.max(0,e)}function T(){let e=r.length-1;for(;e>0&&!/^<\//.test(r[e]);)e--;r.length=Math.max(0,e)}function C(e,n){for(let i=null;e>=0&&A(i);e--){const o=r[e],a=o.match(/^<\/([\w:-]+)>$/);if(a)i=a[1];else if(/>$/.test(o)||(r[e]=KE(o,null,n,t,y,b)))break}}function O(e){let t=r.length-1;if(r.length>1){const e=r[r.length-1];/^(?:<!|$)/.test(e)&&-1===e.indexOf(m)&&t--}C(t,e)}(t.sortAttributes&&"function"!=typeof t.sortAttributes||t.sortClassName&&"function"!=typeof t.sortClassName)&&await async function(e,t,n,r){const i=t.sortAttributes&&Object.create(null),o=t.sortClassName&&new NE;function a(e){return e.map(function(e){return t.name(e.name)})}function s(e,t){return!t||-1===e.indexOf(t)}function u(e){return s(e,n)&&s(e,r)}const l=t.log;if(t.log=Db,t.sortAttributes=!1,t.sortClassName=!1,await async function e(n){let r,s;const l=new ME(n,{start:function(e,n){i&&(i[e]||(i[e]=new NE),i[e].add(a(n).filter(u)));for(let i=0,a=n.length;i<a;i++){const a=n[i];o&&a.value&&"class"===t.name(a.name)?o.add(IE(a.value).split(/[ \t\n\f\r]+/).filter(u)):t.processScripts&&"type"===a.name.toLowerCase()&&(r=e,s=a.value)}},end:function(){r=""},chars:async function(n){t.processScripts&&Rb.has(r)&&t.processScripts.indexOf(s)>-1&&await e(n)}});await l.parse()}(await wb(e,t)),t.log=l,i){const e=Object.create(null);for(const t in i)e[t]=i[t].createSorter();t.sortAttributes=function(t,n){const r=e[t];if(r){const e=Object.create(null),t=a(n);t.forEach(function(t,r){(e[t]||(e[t]=[])).push(n[r])}),r.sort(t).forEach(function(t,r){n[r]=e[t].shift()})}}}if(o){const e=o.createSorter();t.sortClassName=function(t){return e.sort(t.split(/[ \n\f\r]+/)).join(" ")}}}(e,t,m,g);const R=new ME(e,{partialMarkup:n,continueOnParseError:t.continueOnParseError,customAttrAssign:t.customAttrAssign,customAttrSurround:t.customAttrSurround,html5:t.html5,start:async function(e,n,d,h,m){"svg"===e.toLowerCase()&&((t=Object.create(t)).caseSensitive=!0,t.keepClosingSlash=!0,t.name=Db),e=t.name(e),s=e,i=e,b.has(e)||(a=""),o=!1,u=n;let _=t.removeOptionalTags;if(_){const t=_b.has(e);t&&function(e,t){switch(e){case"html":case"head":return!0;case"body":return!rb.has(t);case"colgroup":return"col"===t;case"tbody":return"tr"===t}return!1}(f,e)&&D(),f="",t&&function(e,t){switch(e){case"html":case"head":case"body":case"colgroup":case"caption":return!0;case"li":case"optgroup":case"tr":return t===e;case"dt":case"dd":return ib.has(t);case"p":return ob.has(t);case"rb":case"rt":case"rp":return sb.has(t);case"rtc":return ub.has(t);case"option":return lb.has(t);case"thead":case"tbody":return cb.has(t);case"tfoot":return"tbody"===t;case"td":case"th":return pb.has(t)}return!1}(p,e)&&(T(),_=!function(e,t){switch(t){case"colgroup":return"colgroup"===e;case"tbody":return fb.has(e)}return!1}(p,e)),p=""}t.collapseWhitespace&&(l.length||O(e),d||(A(e,n)&&!l.length||l.push(e),function(e,n){return t.canCollapseWhitespace(e,n,bb)}(e,n)&&!c.length||c.push(e)));const v="<"+e,E=h&&t.keepClosingSlash;r.push(v),t.sortAttributes&&t.sortAttributes(e,n);const y=[];for(let r=n.length,i=!0;--r>=0;){const o=await Sb(n[r],n,e,t);o&&(y.unshift(Ab(o,E,t,i,g)),i=!1)}y.length>0?(r.push(" "),r.push.apply(r,y)):_&&tb.has(e)&&(f=e),r.push(r.pop()+(E?"/":"")+">"),m&&!t.includeAutoGeneratedTags&&(D(),f="")},end:function(e,n,u){"svg"===e.toLowerCase()&&(t=Object.getPrototypeOf(t)),e=t.name(e),t.collapseWhitespace&&(l.length?e===l[l.length-1]&&l.pop():O("/"+e),c.length&&e===c[c.length-1]&&c.pop());let d=!1;e===s&&(s="",d=!o),t.removeOptionalTags&&(d&&db.has(f)&&D(),f="",!_b.has(e)||!p||gb.has(p)||"p"===p&&ab.has(e)||T(),p=nb.has(e)?e:""),t.removeEmptyElements&&d&&function(e,t){switch(e){case"textarea":return!1;case"audio":case"script":case"video":if(Eb("src",t))return!1;break;case"iframe":if(Eb("src",t)||Eb("srcdoc",t))return!1;break;case"object":if(Eb("data",t))return!1;break;case"applet":if(Eb("code",t))return!1}return!0}(e,n)?(D(),f="",p=""):(u&&!t.includeAutoGeneratedTags?p="":r.push("</"+e+">"),i="/"+e,y.has(e)?d&&(a+="|"):a="")},chars:async function(e,n,d){if(n=""===n?"comment":n,d=""===d?"comment":d,t.decodeEntities&&e&&!Rb.has(s)&&(e=function(e,t=Hc.Legacy){return Qc(e,t)}(e)),t.collapseWhitespace){if(!l.length){if("comment"===n){const o=r[r.length-1];if(-1===o.indexOf(m)&&(o||(n=i),r.length>1&&(!o||!t.conservativeCollapse&&/ $/.test(a)))){const t=r.length-2;r[t]=r[t].replace(/\s+$/,function(t){return e=t+e,""})}}if(n)if("/nobr"===n||"wbr"===n){if(/^\s/.test(e)){let e=r.length-1;for(;e>0&&0!==r[e].lastIndexOf("<"+n);)e--;C(e-1,"br")}}else b.has("/"===n.charAt(0)?n.slice(1):n)&&(e=LE(e,t,/(?:^|\s)$/.test(a)));!(e=n||d?KE(e,n,d,t,y,b):LE(e,t,!0,!0))&&/\s$/.test(a)&&n&&"/"===n.charAt(0)&&C(r.length-1,d)}c.length||"html"===d||n&&d||(e=LE(e,t,!1,!1,!0))}t.processScripts&&Rb.has(s)&&(e=await async function(e,t,n){for(let r=0,i=n.length;r<i;r++)if("type"===n[r].name.toLowerCase()&&t.processScripts.indexOf(n[r].value)>-1)return await wb(e,t);return e}(e,t,u)),function(e,t){if("script"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("type"===t[e].name.toLowerCase())return WE(t[e].value);return!0}(s,u)&&(e=await t.minifyJS(e)),qE(s,u)&&(e=await t.minifyCSS(e)),t.removeOptionalTags&&e&&(("html"===f||"body"===f&&!/^\s/.test(e))&&D(),f="",(hb.has(p)||mb.has(p)&&!/^\s/.test(e))&&T(),p=""),i=/^\s*$/.test(e)?n:"comment",t.decodeEntities&&e&&!Rb.has(s)&&(e=e.replace(/&((?:Iacute|aacute|uacute|plusmn|Otilde|otilde|agrave|Agrave|Yacute|yacute|Oslash|oslash|atilde|Atilde|brvbar|ccedil|Ccedil|Ograve|curren|divide|eacute|Eacute|ograve|Oacute|egrave|Egrave|Ugrave|frac12|frac14|frac34|ugrave|oacute|iacute|Ntilde|ntilde|Uacute|middot|igrave|Igrave|iquest|Aacute|cedil|laquo|micro|iexcl|Icirc|icirc|acirc|Ucirc|Ecirc|ocirc|Ocirc|ecirc|ucirc|Aring|aring|AElig|aelig|acute|pound|raquo|Acirc|times|THORN|szlig|thorn|COPY|auml|ordf|ordm|Uuml|macr|uuml|Auml|ouml|Ouml|para|nbsp|euml|quot|QUOT|Euml|yuml|cent|sect|copy|sup1|sup2|sup3|iuml|Iuml|ETH|shy|reg|not|yen|amp|AMP|REG|uml|eth|deg|gt|GT|LT|lt)(?!;)|(?:#?[0-9a-zA-Z]+;))/g,"&$1").replace(/</g,"<")),_&&t.collapseWhitespace&&l.length&&(e=e.replace(_,function(e,t,n){return h[+n][0]})),a+=e,e&&(o=!0),r.push(e)},comment:async function(e,n){const i=n?"<!":"\x3c!--",o=n?">":"--\x3e";e=function(e){return/^\[if\s[^\]]+]|\[endif]$/.test(e)}(e)?i+await async function(e,t){return t.processConditionalComments?await dE(e,/^(\[if\s[^\]]+]>)([\s\S]*?)(<!\[endif])$/,async function(e,n,r,i){return n+await wb(r,t,!0)+i}):e}(e,t)+o:t.removeComments?function(e,t){for(let n=0,r=t.ignoreCustomComments.length;n<r;n++)if(t.ignoreCustomComments[n].test(e))return!0;return!1}(e,t)?"\x3c!--"+e+"--\x3e":"":i+e+o,t.removeOptionalTags&&e&&(f="",p=""),r.push(e)},doctype:function(e){r.push(t.useShortDoctype?"<!doctype"+(t.removeTagWhitespace?"":" ")+"html>":PE(e))}});return await R.parse(),t.removeOptionalTags&&(db.has(f)&&D(),p&&!gb.has(p)&&T()),t.collapseWhitespace&&O("br"),function(e,t,n,r){let i;const o=t.maxLineLength,a=t.noNewlinesBeforeTagClose;if(o){let t="";const s=[];for(;e.length;){const i=t.length,u=e[0].indexOf("\n"),l=Boolean(e[0].match(yE)),c=a&&l;u<0?t+=r(n(e.shift())):(t+=r(n(e[0].slice(0,u))),e[0]=e[0].slice(u+1)),i>0&&t.length>o&&!c?(s.push(t.slice(0,i)),t=t.slice(i)):u>=0&&(s.push(t),t="")}t&&s.push(t),i=s.join("\n")}else i=r(n(e.join("")));return t.collapseWhitespace?LE(i,t,!0,!0):i}(r,t,_?function(e){return e.replace(_,function(e,n,r,i){let o=h[+r][0];return t.collapseWhitespace?("\t"!==n&&(o=n+o),"\t"!==i&&(o+=i),LE(o,{preserveLineBreaks:t.preserveLineBreaks,conservativeCollapse:!t.trimCustomFragments},/^[ \n\r\t\f]/.test(o),/[ \n\r\t\f]$/.test(o))):o})}:Db,m?function(e){return e.replace(new RegExp("\x3c!--"+m+"([0-9]+)--\x3e","g"),function(e,t){return d[+t]})}:Db)}const kb=async function(e,t){const n=Date.now();t=Cb(t||{});const r=await wb(e,t);return t.log("minified in: "+(Date.now()-n)+"ms"),r};var xb={minify:kb};e.default=xb,e.minify=kb,Object.defineProperty(e,"__esModule",{value:!0})});
|
package/package.json
CHANGED
package/src/htmlminifier.js
CHANGED
|
@@ -240,14 +240,15 @@ function isNumberTypeAttribute(attrName, tag) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
function isLinkType(tag, attrs, value) {
|
|
243
|
-
if (tag !== 'link')
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return true;
|
|
243
|
+
if (tag !== 'link') return false;
|
|
244
|
+
const needle = String(value).toLowerCase();
|
|
245
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
246
|
+
if (attrs[i].name.toLowerCase() === 'rel') {
|
|
247
|
+
const tokens = String(attrs[i].value).toLowerCase().split(/\s+/);
|
|
248
|
+
if (tokens.includes(needle)) return true;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
+
return false;
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
function isMediaQuery(tag, attrs, attrName) {
|
|
@@ -274,7 +275,16 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
274
275
|
return attrValue;
|
|
275
276
|
} else if (isUriTypeAttribute(attrName, tag)) {
|
|
276
277
|
attrValue = trimWhitespace(attrValue);
|
|
277
|
-
|
|
278
|
+
if (isLinkType(tag, attrs, 'canonical')) {
|
|
279
|
+
return attrValue;
|
|
280
|
+
}
|
|
281
|
+
try {
|
|
282
|
+
const out = await options.minifyURLs(attrValue);
|
|
283
|
+
return typeof out === 'string' ? out : attrValue;
|
|
284
|
+
} catch (err) {
|
|
285
|
+
options.log && options.log(err);
|
|
286
|
+
return attrValue;
|
|
287
|
+
}
|
|
278
288
|
} else if (isNumberTypeAttribute(attrName, tag)) {
|
|
279
289
|
return trimWhitespace(attrValue);
|
|
280
290
|
} else if (attrName === 'style') {
|
|
@@ -288,7 +298,7 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
288
298
|
return attrValue;
|
|
289
299
|
} else if (isSrcset(attrName, tag)) {
|
|
290
300
|
// https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-srcset
|
|
291
|
-
attrValue = trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(function (candidate) {
|
|
301
|
+
attrValue = (await Promise.all(trimWhitespace(attrValue).split(/\s+,\s*|\s*,\s+/).map(async function (candidate) {
|
|
292
302
|
let url = candidate;
|
|
293
303
|
let descriptor = '';
|
|
294
304
|
const match = candidate.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);
|
|
@@ -300,8 +310,14 @@ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, min
|
|
|
300
310
|
descriptor = ' ' + num + suffix;
|
|
301
311
|
}
|
|
302
312
|
}
|
|
303
|
-
|
|
304
|
-
|
|
313
|
+
try {
|
|
314
|
+
const out = await options.minifyURLs(url);
|
|
315
|
+
return (typeof out === 'string' ? out : url) + descriptor;
|
|
316
|
+
} catch (err) {
|
|
317
|
+
options.log && options.log(err);
|
|
318
|
+
return url + descriptor;
|
|
319
|
+
}
|
|
320
|
+
}))).join(', ');
|
|
305
321
|
} else if (isMetaViewport(tag, attrs) && attrName === 'content') {
|
|
306
322
|
attrValue = attrValue.replace(/\s+/g, '').replace(/[0-9]+\.[0-9]+/g, function (numString) {
|
|
307
323
|
// "0.90000" -> "0.9"
|
|
@@ -692,9 +708,21 @@ const processOptions = (inputOptions) => {
|
|
|
692
708
|
const cleanCssOptions = typeof option === 'object' ? option : {};
|
|
693
709
|
|
|
694
710
|
options.minifyCSS = async function (text, type) {
|
|
695
|
-
text =
|
|
696
|
-
|
|
697
|
-
|
|
711
|
+
text = await replaceAsync(
|
|
712
|
+
text,
|
|
713
|
+
/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/ig,
|
|
714
|
+
async function (match, prefix, dq, sq, unq, suffix) {
|
|
715
|
+
const quote = dq != null ? '"' : (sq != null ? "'" : '');
|
|
716
|
+
const url = dq ?? sq ?? unq ?? '';
|
|
717
|
+
try {
|
|
718
|
+
const out = await options.minifyURLs(url);
|
|
719
|
+
return prefix + quote + (typeof out === 'string' ? out : url) + quote + suffix;
|
|
720
|
+
} catch (err) {
|
|
721
|
+
options.log && options.log(err);
|
|
722
|
+
return match;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
);
|
|
698
726
|
|
|
699
727
|
const inputCSS = wrapCSS(text, type);
|
|
700
728
|
|