html-crush 6.1.3 → 6.2.1
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/CHANGELOG.md +17 -2
- package/LICENSE +1 -1
- package/README.md +4 -3
- package/dist/html-crush.esm.js +11 -11
- package/dist/html-crush.umd.js +25 -25
- package/package.json +29 -28
- package/types/index.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 6.
|
|
6
|
+
## 6.2.0 (2026-08-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- do not let a Jinja expression shorten an enclosing protection ([85d955d](https://github.com/codsen/codsen/commit/85d955da49bc586a39e8eb09af5b7bdb9c729145))
|
|
11
|
+
- isolate range state per crush call ([dec5331](https://github.com/codsen/codsen/commit/dec53312c4e55e6519398bd48246d92610a21b06))
|
|
12
|
+
- make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
|
|
13
|
+
- protect every Jinja expression, not only the first ([741d3f5](https://github.com/codsen/codsen/commit/741d3f50c2727b46c124ae26cad048932fa2a180))
|
|
14
|
+
- resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
15
|
+
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
7
16
|
|
|
8
17
|
### Features
|
|
9
18
|
|
|
10
|
-
-
|
|
19
|
+
- add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
|
|
20
|
+
- refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
|
|
21
|
+
|
|
22
|
+
### Reverts
|
|
23
|
+
|
|
24
|
+
- Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
|
|
25
|
+
- Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
|
|
11
26
|
|
|
12
27
|
## 6.0.0 (2022-12-01)
|
|
13
28
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2010-
|
|
3
|
+
Copyright © 2010-2026 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npm i html-crush
|
|
|
33
33
|
## Quick Take
|
|
34
34
|
|
|
35
35
|
```js
|
|
36
|
-
import { strict as assert } from "assert";
|
|
36
|
+
import { strict as assert } from "node:assert";
|
|
37
37
|
|
|
38
38
|
import { crush, defaults, version } from "html-crush";
|
|
39
39
|
|
|
@@ -53,9 +53,10 @@ assert.equal(
|
|
|
53
53
|
);
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
|
|
56
57
|
## Documentation
|
|
57
58
|
|
|
58
|
-
Please [visit codsen.com](https://codsen.com/os/html-crush/) for a full description of the API. Also, try the [GUI playground](https://codsen.com/os/html-crush/play).
|
|
59
|
+
Please [visit codsen.com](https://codsen.com/os/html-crush/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/html-crush/CHANGELOG.md). Also, try the [GUI playground](https://codsen.com/os/html-crush/play).
|
|
59
60
|
|
|
60
61
|
## Contributing
|
|
61
62
|
|
|
@@ -65,6 +66,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
65
66
|
|
|
66
67
|
MIT License
|
|
67
68
|
|
|
68
|
-
Copyright © 2010-
|
|
69
|
+
Copyright © 2010-2026 Roy Revelt and other contributors
|
|
69
70
|
|
|
70
71
|
<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
|
package/dist/html-crush.esm.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name html-crush
|
|
3
3
|
* @fileoverview Minify email templates
|
|
4
|
-
* @version 6.1
|
|
4
|
+
* @version 6.2.1
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/html-crush/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{rApply as
|
|
11
|
-
${
|
|
12
|
-
${
|
|
10
|
+
import{formatDiagnosticValue as G,isLetter as A,isPlainObject as le,isStr as y}from"codsen-utils";import{rApply as oe}from"ranges-apply";import{Ranges as te}from"ranges-push";import{left as W,right as a}from"string-left-right";import{matchLeft as ie,matchRight as w,matchRightIncl as q}from"string-match-left-right";import{expander as B}from"string-range-expander";var K="6.2.1";var he=K,$e={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function Ee(n,E){let x=Date.now();if(!y(n))throw n===void 0?new Error("html-crush/crush(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush/crush(): [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
|
|
11
|
+
${G(n,4)}`);if(E&&!le(E))throw new Error(`html-crush/crush(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof E}, equal to ${G(E,4)}`);if(E&&Array.isArray(E.breakToTheLeftOf)&&E.breakToTheLeftOf.length){for(let T=0,e=E.breakToTheLeftOf.length;T<e;T++)if(!y(E.breakToTheLeftOf[T]))throw new TypeError(`html-crush/crush(): [THROW_ID_04] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${T} is of a type "${typeof E.breakToTheLeftOf[T]}" and is equal to:
|
|
12
|
+
${G(E.breakToTheLeftOf[T],4)}`)}let s=new te({limitToBeAddedWhitespace:!0}),l={...$e,...E};typeof l.removeHTMLComments=="boolean"&&(l.removeHTMLComments=l.removeHTMLComments?1:0);let F="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(F=[...new Set(l.breakToTheLeftOf.map(T=>T[0]))].join(""));let O={removeHTMLComments:!1,removeCSSComments:!1},S=null,i=null,D=!1,m=0,v=0,g=!1,V=!1,c=null,f=null,C=null,R=null,u,t=null,$=null,r=null,d=null,L=null,H=null,P=">};",I="<",z="!",Q=">",Z="<",j="{},:;<>~+",U=j,_=j,N=!0,h=n.length,ee=Math.floor(h/2),Y=.01,X;l.reportProgressFunc&&(X=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*Y-l.reportProgressFuncFrom));let p,M=0,b=`
|
|
13
13
|
`;if(n.includes(`\r
|
|
14
14
|
`)?b=`\r
|
|
15
|
-
`:n.includes("\r")&&(b="\r"),h){for(let e=0;e<h;e++){if(l.reportProgressFunc&&(h>1e3&&h<2e3?e===
|
|
16
|
-
`||n[o]==="\r"||n[o].trim()){o+1<e
|
|
15
|
+
`:n.includes("\r")&&(b="\r"),h){for(let e=0;e<h;e++){if(l.reportProgressFunc&&(h>1e3&&h<2e3?e===ee&&l.reportProgressFunc(Math.floor((l.reportProgressFuncTo-l.reportProgressFuncFrom)/2)):h>=2e3&&(p=l.reportProgressFuncFrom+Math.floor(e/h*(X||1)),p!==M&&(M=p,l.reportProgressFunc(p)))),v++,!u&&g&&n[e]==="}"&&n[e-1]==="}"&&(m+1>=l.lineLengthLimit?(s.push(e,e,b),m=0):(t=e,$=e,r=" ")),u&&typeof u=="number"&&e>=u&&(u=void 0),R!==null&&n.startsWith("</script",e)&&!A(n[e+8])){if((l.removeIndentations||l.removeLineBreaks)&&e>0&&n[~-e]&&!n[~-e].trim()){for(let o=e;o--;)if(n[o]===`
|
|
16
|
+
`||n[o]==="\r"||n[o].trim()){o+1<e&&s.push(o+1,e);break}}R=null,u=!1,e+=8;continue}if(!u&&!g&&n.startsWith("<script",e)&&!A(n[e+7])){R=e,u=!0;let o="";(l.removeLineBreaks||l.removeIndentations)&&i!==null&&(i>0&&(o=b),s.push(i,e,o)),i=null,S=null}if(L!==null&&d===null&&!/\w/.test(n[e])){d=n.slice(L,e);let o=a(n,~-e);typeof o=="number"&&n[o]===">"&&!n[e].trim()&&a(n,e)?s.push(e,a(n,e)):o&&n[o]==="/"&&n[a(n,o)]===">"&&(!n[e].trim()&&a(n,e)&&s.push(e,a(n,e)),n[o+1]!==">"&&a(n,o+1)&&s.push(o+1,a(n,o+1)))}if(!u&&!g&&!c&&n[~-e]==="<"&&L===null&&(/\w/.test(n[e])?L=e:n[a(n,~-e)]==="/"&&/\w/.test(n[a(n,a(n,~-e))]||"")&&(L=a(n,a(n,~-e)))),!u&&(g||c)&&f!==null&&n[e]==="*"&&n[e+1]==="/"&&([t,$]=B({str:n,from:f,to:e+2,ifLeftSideIncludesThisThenCropTightly:U||"",ifRightSideIncludesThisThenCropTightly:_||""}),f=null,t!=null?s.push(t,$):(m+=1,e+=1),u=e+2),!u&&(g||c)&&f===null&&n[e]==="/"&&n[e+1]==="*"&&(O.removeCSSComments||(O.removeCSSComments=!0),l.removeCSSComments&&(f=e)),V&&n.startsWith("![endif",e+1)&&(V=!1),!u&&!g&&!c&&C!==null){let o;n.startsWith("-->",e)?o=3:n[e]===">"&&n[e-1]==="]"&&(o=1),o&&([t,$]=B({str:n,from:C,to:e+o}),C=null,t!=null?l.lineLengthLimit&&v-($-t)>=l.lineLengthLimit?(s.push(t,$,b),v=-o):(s.push(t,$),v-=$-t):(m+=o-1,e+=o-1),u=e+o)}if(!u&&!g&&!c&&(n.startsWith("<!--",e)||l.removeHTMLComments===2&&n.startsWith("<![endif",e))&&C===null&&(n.startsWith("[if",e+4)?(V||(V=!0),l.removeHTMLComments===2&&(C=e)):l.removeHTMLComments&&(!V||l.removeHTMLComments===2)&&(C=e),O.removeHTMLComments||(O.removeHTMLComments=!0)),!u&&g&&f===null&&n.startsWith("</style",e)&&!A(n[e+7])?g=!1:!u&&!g&&f===null&&n.startsWith("<style",e)&&!A(n[e+6])&&(g=!0,(l.removeLineBreaks||l.removeIndentations)&&l.breakToTheLeftOf.includes("<style")&&n.startsWith(' type="text/css">',e+6)&&n[e+24]&&s.push(e+23,e+23,b)),!u&&!c&&`"'`.includes(n[e])&&n.endsWith("style=",e)&&(c=e),!u&&!n[e].trim())i===null&&(i=e);else if(!u&&!((g||c)&&f!==null)){if(i!==null){if(l.removeLineBreaks&&(m+=1),N)N=!1,(l.removeIndentations||l.removeLineBreaks)&&s.push(0,e);else if(l.removeIndentations&&!l.removeLineBreaks&&(!D&&S!==null&&e>S?s.push(S+1,e):i+1<e&&(n.endsWith("]>",i)||n.endsWith("-->",i)||n.startsWith("<![",e)||n.startsWith("<!--<![",e)?s.push(i,e):n[i]===" "?s.push(i+1,e):n[~-e]===" "?s.push(i,~-e):s.push(i,e," "))),l.removeLineBreaks||c){if(F.includes(n[e])&&q(n,e,l.breakToTheLeftOf)){!(`\r
|
|
17
17
|
`.includes(n[~-e])&&i===~-e)&&!(n[~-e]===`
|
|
18
|
-
`&&n[e-2]==="\r"&&i===e-2)
|
|
18
|
+
`&&n[e-2]==="\r"&&i===e-2)&&s.push(i,e,b),t=null,$=null,r=null,i=null,m=1;continue}let o=" ";n[e]==="<"&&w(n,e,l.mindTheInlineTags,{cb:k=>!k||!/\w/.test(k)})||(n[~-i]&&Q.includes(n[~-i])&&Z.includes(n[e])||(g||c)&&f===null&&(U.includes(n[~-i])||_.includes(n[e]))||n.startsWith("!important",e)&&!V||c&&(n[~-i]==="'"||n[~-i]==='"')||n[~-i]==="}"&&n.startsWith("</style",e)||n[e]===">"&&(`'"`.includes(n[W(n,e)])||n[a(n,e)]==="<")||n[e]==="/"&&n[a(n,e)]===">")&&(o="",n[e]==="/"&&n[e+1]===">"&&a(n,e)&&a(n,e)>e+1&&(s.push(e+1,a(n,e)),m-=a(n,e)-e+1)),g&&n[e]==="}"&&i&&n[i-1]==="}"&&(o=" "),o?.length&&(m+=1),l.lineLengthLimit?m>=l.lineLengthLimit||!n[e+1]||n[e]===">"||n[e]==="/"&&n[e+1]===">"?((m>l.lineLengthLimit||m===l.lineLengthLimit&&n[e+1]?.trim()&&!P.includes(n[e])&&!I.includes(n[e+1]))&&(o=b,m=1),(m>l.lineLengthLimit||!(o===" "&&e===i+1))&&(s.push(i,e,o),S=null),t=null,$=null,r=null):(t===null||i<t)&&(t=i,$=e,r=o):e===i+1&&o===" "||s.push(i,e,o)}i=null,D||(D=!0)}else N&&(N=!1),l.removeLineBreaks&&(m+=1);D||(D=!0)}if(!u&&!N&&e!==0&&l.removeLineBreaks&&(l.lineLengthLimit||F)&&!n.startsWith("</a",e)){if(F&&q(n,e,l.breakToTheLeftOf)&&n.slice(0,e).trim()&&(!n.startsWith("<![endif]",e)||!ie(n,e,"<!--"))){s.push(e,e,b),t=null,$=null,r=null,m=1;continue}else if(l.lineLengthLimit&&m<=l.lineLengthLimit){if(!n[e+1]||I.includes(n[e])&&!z.includes(n[e])||P.includes(n[e])||!n[e].trim()){if(t!==null&&$!==null&&(t!==$||r?.length)){let o=r;n[e].trim()&&n[e+1]?.trim()&&m+(r?r.length:0)>l.lineLengthLimit&&(o=b),(m+(o?o.length:0)>l.lineLengthLimit||!(o===" "&&$===t+1&&n[t]===" "))&&(n[~-t]==="}"&&n[$]==="{"||(s.push(t,$,o),S=null))}n[e].trim()&&(I.includes(n[e])||n[~-e]&&P.includes(n[~-e]))&&y(H)&&(!d||!l.mindTheInlineTags.includes(d))&&!(n[e]==="<"&&w(n,e,l.mindTheInlineTags,{cb:o=>!o||!/\w/.test(o)}))&&!(n[e]==="<"&&w(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))?(t=e,$=e,r=null):f===null&&t!==null&&(c||!l.mindTheInlineTags||!Array.isArray(l.mindTheInlineTags)||Array.isArray(l.mindTheInlineTags.length)&&!l.mindTheInlineTags.length||!y(d)||Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&y(d)&&!l.mindTheInlineTags.includes(d))&&!(n[e]==="<"&&w(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))&&(t=null,$=null,r=null)}}else if(l.lineLengthLimit)if(I.includes(n[e])&&!(n[e]==="<"&&w(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)})))if(t!==null&&$!==null&&(t!==$||r?.length)){let o=r?.length?r.length:0;m-($-t-o)-1>l.lineLengthLimit||(s.push(t,$,r),m-($-t-o)-1===l.lineLengthLimit&&(s.push(e,e,b),m=0),t=null,$=null,r=null)}else s.push(e,e,b),m=0;else n[e+1]&&P.includes(n[e])&&y(d)&&Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&!l.mindTheInlineTags.includes(d)?t!==null&&$!==null&&(t!==$||r?.length)||(s.push(e+1,e+1,b),m=0):n[e].trim()&&(n[e+1]||t!==null&&$!==null&&(t!==$||r?.length)&&s.push(t,$,b))}if(!u&&!N&&l.removeLineBreaks&&l.lineLengthLimit&&m>=l.lineLengthLimit&&t!==null&&$!==null&&!P.includes(n[e])&&!I.includes(n[e])&&!"/".includes(n[e])&&!(m===l.lineLengthLimit&&n[e+1]&&!n[e+1].trim())){let o=b;n[e+1]&&!n[e+1].trim()&&m===l.lineLengthLimit&&(o=r),o===b&&!n[~-t].trim()&&W(n,t)&&(t=W(n,t)+1),s.push(t,$,o),m=e-$,n[e].length&&(m+=1),t=null,$=null,r=null}if((!u&&n[e]===`
|
|
19
19
|
`||n[e]==="\r"&&(!n[e+1]||n[e+1]&&n[e+1]!==`
|
|
20
|
-
`))&&(
|
|
21
|
-
|
|
22
|
-
`&&n[e]!=="\r"
|
|
20
|
+
`))&&(S=e,D&&(D=!1),!l.removeLineBreaks&&i!==null&&i<e&&n[e+1]&&n[e+1]!=="\r"&&n[e+1]!==`
|
|
21
|
+
`&&s.push(i,e)),n[e+1]||(g&&f!==null?s.push([...B({str:n,from:f,to:e,ifLeftSideIncludesThisThenCropTightly:U||"",ifRightSideIncludesThisThenCropTightly:_||""})]):i&&n[e]!==`
|
|
22
|
+
`&&n[e]!=="\r"?s.push(i,e+1):i&&(n[e]==="\r"&&n[e+1]===`
|
|
23
23
|
`||n[e]===`
|
|
24
|
-
`&&n[e-1]!=="\r")
|
|
24
|
+
`&&n[e-1]!=="\r")&&s.push(i,e)),!u&&c&&c<e&&n[c]===n[e]&&(c=null),!u&&!g&&n.startsWith("<pre",e)&&!A(n[e+4])){let o=n.indexOf("</pre",e+5);o>0&&(u=o)}if(!u&&!g&&n.startsWith("<code",e)&&!A(n[e+5])){let o=n.indexOf("</code",e+5);o>0&&(u=o)}if(!u&&n.startsWith("<![CDATA[",e)){let o=n.indexOf("]]>",e+9);o>0&&(u=o)}if(!u&&!g&&!c&&L!==null&&n[e]===">"&&(n[a(n,e)]==="<"&&(H=d),L=null,d=null),n[e]==="<"&&H!==null&&(H=null),!u&&g&&n[e]==="{"&&n[e+1]==="{"){let o=n.indexOf("}}",e+2);o!==-1&&(u=o+2)}let J=!0}let T=s.current();if(T){let e=l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*Y,J=oe(n,T,k=>{l.reportProgressFunc&&h>=2e3&&(p=Math.floor(e+(l.reportProgressFuncTo-e)*(k/100)),p!==M&&(M=p,l.reportProgressFunc(p)))}),o=J.length;return{log:{timeTakenInMilliseconds:Date.now()-x,originalLength:h,cleanedLength:o,bytesSaved:Math.max(h-o,0),percentageReducedOfOriginal:h?Math.round(Math.max(h-o,0)*100/h):0},ranges:T,applicableOpts:O,result:J}}}return{log:{timeTakenInMilliseconds:Date.now()-x,originalLength:h,cleanedLength:h,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:O,ranges:null,result:n}}export{Ee as crush,$e as defaults,he as version};
|
package/dist/html-crush.umd.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name html-crush
|
|
3
3
|
* @fileoverview Minify email templates
|
|
4
|
-
* @version 6.1
|
|
4
|
+
* @version 6.2.1
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/html-crush/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var htmlCrush=(()=>{var Pe=Object.create;var G=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames,ge=Object.getOwnPropertySymbols,_e=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var Z=(e,r,l)=>r in e?G(e,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[r]=l,w=(e,r)=>{for(var l in r||(r={}))me.call(r,l)&&Z(e,l,r[l]);if(ge)for(var l of ge(r))xe.call(r,l)&&Z(e,l,r[l]);return e};var ke=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),We=(e,r)=>{for(var l in r)G(e,l,{get:r[l],enumerable:!0})},ce=(e,r,l,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Fe(r))!me.call(e,a)&&a!==l&&G(e,a,{get:()=>r[a],enumerable:!(t=He(r,a))||t.enumerable});return e};var fe=(e,r,l)=>(l=e!=null?Pe(_e(e)):{},ce(r||!e||!e.__esModule?G(l,"default",{value:e,enumerable:!0}):l,e)),Je=e=>ce(G({},"__esModule",{value:!0}),e);var ee=(e,r,l)=>Z(e,typeof r!="symbol"?r+"":r,l);var ne=ke(($t,be)=>{"use strict";be.exports=Ue;function W(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Ue(e){if(e=e||{},e.circles)return Ge(e);let r=new Map;if(r.set(Date,u=>new Date(u)),r.set(Map,(u,s)=>new Map(t(Array.from(u),s))),r.set(Set,(u,s)=>new Set(t(Array.from(u),s))),e.constructorHandlers)for(let u of e.constructorHandlers)r.set(u[0],u[1]);let l=null;return e.proto?i:a;function t(u,s){let g=Object.keys(u),o=new Array(g.length);for(let m=0;m<g.length;m++){let c=g[m],y=u[c];typeof y!="object"||y===null?o[c]=y:y.constructor!==Object&&(l=r.get(y.constructor))?o[c]=l(y,s):ArrayBuffer.isView(y)?o[c]=W(y):o[c]=s(y)}return o}function a(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return t(u,a);if(u.constructor!==Object&&(l=r.get(u.constructor)))return l(u,a);let s={};for(let g in u){if(Object.hasOwnProperty.call(u,g)===!1)continue;let o=u[g];typeof o!="object"||o===null?s[g]=o:o.constructor!==Object&&(l=r.get(o.constructor))?s[g]=l(o,a):ArrayBuffer.isView(o)?s[g]=W(o):s[g]=a(o)}return s}function i(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return t(u,i);if(u.constructor!==Object&&(l=r.get(u.constructor)))return l(u,i);let s={};for(let g in u){let o=u[g];typeof o!="object"||o===null?s[g]=o:o.constructor!==Object&&(l=r.get(o.constructor))?s[g]=l(o,i):ArrayBuffer.isView(o)?s[g]=W(o):s[g]=i(o)}return s}}function Ge(e){let r=[],l=[],t=new Map;if(t.set(Date,g=>new Date(g)),t.set(Map,(g,o)=>new Map(i(Array.from(g),o))),t.set(Set,(g,o)=>new Set(i(Array.from(g),o))),e.constructorHandlers)for(let g of e.constructorHandlers)t.set(g[0],g[1]);let a=null;return e.proto?s:u;function i(g,o){let m=Object.keys(g),c=new Array(m.length);for(let y=0;y<m.length;y++){let h=m[y],$=g[h];if(typeof $!="object"||$===null)c[h]=$;else if($.constructor!==Object&&(a=t.get($.constructor)))c[h]=a($,o);else if(ArrayBuffer.isView($))c[h]=W($);else{let O=r.indexOf($);O!==-1?c[h]=l[O]:c[h]=o($)}}return c}function u(g){if(typeof g!="object"||g===null)return g;if(Array.isArray(g))return i(g,u);if(g.constructor!==Object&&(a=t.get(g.constructor)))return a(g,u);let o={};r.push(g),l.push(o);for(let m in g){if(Object.hasOwnProperty.call(g,m)===!1)continue;let c=g[m];if(typeof c!="object"||c===null)o[m]=c;else if(c.constructor!==Object&&(a=t.get(c.constructor)))o[m]=a(c,u);else if(ArrayBuffer.isView(c))o[m]=W(c);else{let y=r.indexOf(c);y!==-1?o[m]=l[y]:o[m]=u(c)}}return r.pop(),l.pop(),o}function s(g){if(typeof g!="object"||g===null)return g;if(Array.isArray(g))return i(g,s);if(g.constructor!==Object&&(a=t.get(g.constructor)))return a(g,s);let o={};r.push(g),l.push(o);for(let m in g){let c=g[m];if(typeof c!="object"||c===null)o[m]=c;else if(c.constructor!==Object&&(a=t.get(c.constructor)))o[m]=a(c,s);else if(ArrayBuffer.isView(c))o[m]=W(c);else{let y=r.indexOf(c);y!==-1?o[m]=l[y]:o[m]=s(c)}}return r.pop(),l.pop(),o}}});var rt={};We(rt,{crush:()=>nt,defaults:()=>Ce,version:()=>tt});var Be={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function k(e,r){if(!Array.isArray(e)||!e.length)return e;let l=w(w({},Be),r),t,a;if(l.strictlyTwoElementsInRangeArrays&&!e.every((s,g)=>!Array.isArray(s)||s.length!==2?(t=g,a=s.length,!1):!0))throw new TypeError("ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(t,"th range (").concat(JSON.stringify(e[t],null,4),") has not two but ").concat(a," elements!"));if(!e.every((s,g)=>!Array.isArray(s)||!Number.isInteger(s[0])||s[0]<0||!Number.isInteger(s[1])||s[1]<0?(t=g,!1):!0))throw new TypeError("ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(t,"th range (").concat(JSON.stringify(e[t],null,4),") does not consist of only natural numbers!"));let i=e.length**2,u=0;return Array.from(e).sort((s,g)=>(l.progressFn&&(u+=1,l.progressFn(Math.floor(u*100/i))),s[0]===g[0]?s[1]<g[1]?-1:s[1]>g[1]?1:0:s[0]<g[0]?-1:1))}var he={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function $e(e,r){function l(o){return!!o&&typeof o=="object"&&!Array.isArray(o)}if(!Array.isArray(e)||!e.length)return null;let t;if(r)if(l(r)){if(t=w(w({},he),r),t.progressFn&&l(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "'.concat(typeof t.progressFn,'", equal to ').concat(JSON.stringify(t.progressFn,null,4)));if(![1,2,"1","2"].includes(t.mergeType))throw new Error('ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(JSON.stringify(t.mergeType,null,4)));if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof t.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(t.joinRangesThatTouchEdges,null,4)))}else throw new Error("emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(r,null,4)," (type ").concat(typeof r,")"));else t=w({},he);let a=e.filter(o=>Array.isArray(o)).map(o=>[...o]).filter(o=>o[2]!==void 0||o[0]!==o[1]),i,u,s;t.progressFn?i=k(a,{progressFn:o=>{s=Math.floor(o/5),s!==u&&(u=s,t.progressFn(s))}}):i=k(a);let g=i.length-1;for(let o=g;o>0;o--)t.progressFn&&(s=Math.floor((1-o/g)*78)+21,s!==u&&s>u&&(u=s,t.progressFn(s))),(i[o][0]<=i[o-1][0]||!t.joinRangesThatTouchEdges&&i[o][0]<i[o-1][1]||t.joinRangesThatTouchEdges&&i[o][0]<=i[o-1][1])&&(i[o-1][0]=Math.min(i[o][0],i[o-1][0]),i[o-1][1]=Math.max(i[o][1],i[o-1][1]),i[o][2]!==void 0&&(i[o-1][0]>=i[o][0]||i[o-1][1]<=i[o][1])&&i[o-1][2]!==null&&(i[o][2]===null&&i[o-1][2]!==null?i[o-1][2]=null:i[o-1][2]!=null?+t.mergeType==2&&i[o-1][0]===i[o][0]?i[o-1][2]=i[o][2]:i[o-1][2]+=i[o][2]:i[o-1][2]=i[o][2]),i.splice(o,1),o=i.length);return i.length?i:null}var je=!0,te="Invariant failed";function pe(e,r){if(!e){if(je)throw new Error(te);var l=typeof r=="function"?r():r,t=l?"".concat(te,": ").concat(l):te;throw new Error(t)}}function de(e,r,l){let t=0,a=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(JSON.stringify(e,null,4)));if(r&&!Array.isArray(r))throw new TypeError("ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof r,", equal to: ").concat(JSON.stringify(r,null,4)));if(l&&typeof l!="function")throw new TypeError("ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ".concat(typeof l,", equal to: ").concat(JSON.stringify(l,null,4)));if(!(r!=null&&r.filter(m=>m).length))return e;let i;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?i=[Array.from(r)]:i=Array.from(r);let u=i.length,s=0;i.filter(m=>m).forEach((m,c)=>{if(l&&(t=Math.floor(s/u*10),t!==a&&(a=t,l(t))),!Array.isArray(m))throw new TypeError("ranges-apply: [THROW_ID_05] ranges array, second input arg., has ".concat(c,"th element not an array: ").concat(JSON.stringify(m,null,4),", which is ").concat(typeof m));if(!Number.isInteger(m[0])){if(!Number.isInteger(+m[0])||+m[0]<0)throw new TypeError("ranges-apply: [THROW_ID_06] ranges array, second input arg. has ".concat(c,"th element, array ").concat(JSON.stringify(m,null,0),". Its first element is not an integer, string index, but ").concat(typeof m[0],", equal to: ").concat(JSON.stringify(m[0],null,4),"."));i[c][0]=+i[c][0]}if(!Number.isInteger(m[1])){if(!Number.isInteger(+m[1])||+m[1]<0)throw new TypeError("ranges-apply: [THROW_ID_07] ranges array, second input arg. has ".concat(c,"th element, array ").concat(JSON.stringify(m,null,0),". Its second element is not an integer, string index, but ").concat(typeof m[1],", equal to: ").concat(JSON.stringify(m[1],null,4),"."));i[c][1]=+i[c][1]}s+=1});let g=$e(i,{progressFn:m=>{l&&(t=10+Math.floor(m/10),t!==a&&(a=t,l(t)))}});pe(g);let o=g.length;if(o>0){let m=e.slice(g[o-1][1]);e=g.reduce((c,y,h,$)=>{l&&(t=20+Math.floor(h/o*80),t!==a&&(a=t,l(t)));let O=h===0?0:$[h-1][1],C=$[h][0];return"".concat(c).concat(e.slice(O,C)).concat($[h][2]||"")},""),e+=m}return e}function Y(e,r=1){let l="\xA0";function t(i){return Array.from(i).reverse().join("")}function a(i,u,s){let g=s?"\n":"\r",o=s?"\r":"\n";if(!i)return i;let m=0,c=0,y="";for(let h=0,$=i.length;h<$;h++)(i[h]===g||i[h]===o&&i[h-1]!==g)&&c++,"\r\n".includes(i[h])||i[h]===l?(m=0,i[h]===l?y+=i[h]:i[h]===g?c<=u&&(y+=i[h],i[h+1]===o&&(y+=i[h+1],h++)):i[h]===o&&(i==null?void 0:i[h-1])!==g&&c<=u&&(y+=i[h])):(m++,!i[h+1]&&!c&&(y+=" "));return y}if(typeof e=="string"&&e.length){let i=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(i=+r);let u="",s="";if(!e.trim())u=e;else if(!e[0].trim()){for(let g=0,o=e.length;g<o;g++)if(e[g].trim()){u=e.slice(0,g);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===l)){for(let g=e.length;g--;)if(e[g].trim()){s=e.slice(g+1);break}}return"".concat(a(u,i,!1)).concat(e.trim()).concat(t(a(t(s),i,!0)))}return e}var Te=fe(ne(),1);var pt=(0,Te.default)();function F(e){return S(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function M(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function S(e){return typeof e=="string"}function ye(e){return Number.isFinite(e)}function R(e){return Number.isSafeInteger(e)&&e>=0}function P(e){return e!=null}function Ee(e,r){return M(e)&&S(r)&&r in e}var Se={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qe(e,r){var o;function l(m){return!!m&&typeof m=="object"&&!Array.isArray(m)}if(!Array.isArray(e)||!e.length)return null;let t;if(r)if(l(r)){if(t=w(w({},Se),r),t.progressFn&&l(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof t.progressFn,'", equal to ').concat(JSON.stringify(t.progressFn,null,4)));if(![1,2,"1","2"].includes(t.mergeType))throw new Error('ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(JSON.stringify(t.mergeType,null,4)));if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof t.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(t.joinRangesThatTouchEdges,null,4)))}else throw new Error("ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(r,null,4)," (type ").concat(typeof r,")"));else t=w({},Se);let a=e.filter(m=>Array.isArray(m)).map(m=>[...m]).filter(m=>m[2]!==void 0||m[0]!==m[1]),i,u,s;t.progressFn?i=k(a,{progressFn:m=>{s=Math.floor(m/5),s!==u&&(u=s,t.progressFn!=null&&t.progressFn(s))}}):i=k(a);let g=i.length-1;for(let m=g;m>0;m--)t.progressFn&&(s=Math.floor((1-m/g)*78)+21,s!==u&&s>u&&(u=s,t.progressFn(s))),(i[m][0]<=i[m-1][0]||!t.joinRangesThatTouchEdges&&i[m][0]<i[m-1][1]||t.joinRangesThatTouchEdges&&i[m][0]<=i[m-1][1])&&(i[m-1][0]=Math.min(i[m][0],i[m-1][0]),i[m-1][1]=Math.max(i[m][1],i[m-1][1]),i[m][2]!==void 0&&(i[m-1][0]>=i[m][0]||i[m-1][1]<=i[m][1])&&i[m-1][2]!==null&&(i[m][2]===null&&i[m-1][2]!==null?i[m-1][2]=null:i[m-1][2]!=null?+((o=t||{})==null?void 0:o.mergeType)==2&&i[m-1][0]===i[m][0]?i[m-1][2]=i[m][2]:i[m-1][2]+=i[m][2]:i[m-1][2]=i[m][2]),i.splice(m,1),m=i.length);return i.length?i:null}var Ye={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Oe=class{constructor(e){ee(this,"ranges");ee(this,"opts");let r=w(w({},Ye),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(S(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(S(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error('ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(JSON.stringify(r.mergeType,null,4)));this.opts=r,this.ranges=[]}add(e,r,l){var i;if(e==null&&r==null)return;if(P(e)&&!P(r)){if(Array.isArray(e)){if(e.length){if(e.some(u=>Array.isArray(u))){e.forEach(u=>{Array.isArray(u)&&this.add(...u)});return}e.length&&R(+e[0])&&R(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set ('.concat(JSON.stringify(e,null,0),') but second-one, "to" is not (').concat(JSON.stringify(r,null,0),")"))}else if(!P(e)&&P(r))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set ('.concat(JSON.stringify(r,null,0),') but first-one, "from" is not (').concat(JSON.stringify(e,null,0),")"));let t=+e,a=+r;if(R(t)&&R(a)){if(P(l)&&!S(l)&&!ye(l))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ".concat(typeof l,", equal to:\n").concat(JSON.stringify(l,null,4)));if(P(this.ranges)&&Array.isArray(this.last())&&t===this.last()[1]){if(this.last()[1]=a,this.last()[2],this.last()[2]!==null&&P(l)){let u=this.last()[2]&&this.last()[2].length&&(!((i=this.opts)!=null&&i.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(l):l;this.opts.limitToBeAddedWhitespace&&(u=Y(u,this.opts.limitLinebreaksCount)),S(u)&&!u.length||(this.last()[2]=u)}}else{this.ranges||(this.ranges=[]);let u=l!==void 0&&!(S(l)&&!l.length)?[t,a,l&&this.opts.limitToBeAddedWhitespace?Y(l,this.opts.limitLinebreaksCount):l]:[t,a];this.ranges.push(u)}}else throw R(t)&&t>=0?new TypeError('ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof a,'" equal to: ').concat(JSON.stringify(a,null,4))):new TypeError('ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof t,'" equal to: ').concat(JSON.stringify(t,null,4)))}push(e,r,l){this.add(e,r,l)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=qe(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>P(e[2])?[e[0],e[1],Y(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&R(e[0][0]))this.ranges=Array.from(e);else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ".concat(JSON.stringify(e[0],null,4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};function we(e){return typeof e!="string"?e:e.length?[e]:[]}var Le={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Ke=e=>e+1;function ze(e,r,l,t,a=!1,i=Ke){var b;let u=typeof l=="function"?l():l;if(+r<0&&a&&u==="EOL")return u;let s=w(w({},Le),t);if(r>=e.length&&!a)return!1;let g=a?1:l.length,o=0,m=!1,c=!1,y=!1,h=s.maxMismatches,$=r,O=!1,C=!1,T=!1;function p(){return o===1&&h<s.maxMismatches-1}for(;e[$];){let d=i($);if(s.trimBeforeMatching&&e[$].trim()===""){if(!e[d]&&a&&l==="EOL")return!0;$=i($);continue}if(s&&!s.i&&((b=s==null?void 0:s.trimCharsBeforeMatching)!=null&&b.includes(e[$]))||s!=null&&s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(N=>N.toLowerCase()).includes(e[$].toLowerCase())){if(a&&l==="EOL"&&!e[d])return!0;$=i($);continue}let D=d>$?l[l.length-g]:l[g-1];if(!s.i&&e[$]===D||s.i&&e[$].toLowerCase()===D.toLowerCase()){if(O||(O=!0),y||(y=!0),g===l.length){if(C=!0,h!==s.maxMismatches)return!1}else g===1&&(T=!0);if(g-=1,o++,p())return!1;if(!g)return o!==l.length||h===s.maxMismatches||!m?$:!1}else if(!m&&!o&&(m=!0),s.maxMismatches&&h&&$){h-=1;for(let N=0;N<=h;N++){let v=d>$?l[l.length-g+1+N]:l[g-2-N],V=e[i($)];if(v&&(!s.i&&e[$]===v||s.i&&e[$].toLowerCase()===v.toLowerCase())&&(!s.firstMustMatch||g!==l.length)){if(o++,p())return!1;g-=2,O=!0;break}else if(V&&v&&(!s.i&&V===v||s.i&&V.toLowerCase()===v.toLowerCase())&&(!s.firstMustMatch||g!==l.length)){if(!o&&!s.hungry)return!1;g-=1,O=!0;break}else if(v===void 0&&h>=0&&O&&(!s.firstMustMatch||C)&&(!s.lastMustMatch||T))return $}O||(c=$)}else return $===0&&g===1&&!s.lastMustMatch&&y?0:!1;if(c!==!1&&c!==$&&(c=!1),g<1)return $;$=i($)}if(g>0)return a&&u==="EOL"?!0:s&&s.maxMismatches>=g&&y?c||0:!1}function re(e,r,l,t,a){var m,c,y;if(M(a)&&Ee(a,"trimBeforeMatching")&&a&&typeof a.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(a.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let i=w(w({},Le),a);if(typeof i.trimCharsBeforeMatching=="string"&&(i.trimCharsBeforeMatching=we(i.trimCharsBeforeMatching)),i.trimCharsBeforeMatching=i.trimCharsBeforeMatching.map(h=>S(h)?h:String(h)),!S(r)||!r.length)return!1;if(!Number.isInteger(l)||l<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ").concat(typeof l,", equal to:\n").concat(JSON.stringify(l,null,4)));let u,s;if(S(t))u=[t];else if(Array.isArray(t))u=t;else if(!t)u=t;else if(typeof t=="function")u=[],u.push(t);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof t,", equal to:\n").concat(JSON.stringify(t,null,4)));if(a&&!M(a))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof a,'", and equal to:\n').concat(JSON.stringify(a,null,4)));let g=0,o="";if((m=i==null?void 0:i.trimCharsBeforeMatching)!=null&&m.some((h,$)=>h.length>1?(g=$,o=h,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(g," is longer than 1 character, ").concat(o.length," (equals to ").concat(o,"). Please split it into separate characters and put into array as separate elements."));if(!u||!Array.isArray(u)||Array.isArray(u)&&!u.length||Array.isArray(u)&&u.length===1&&S(u[0])&&!u[0].trim()){if(typeof i.cb=="function"){let $,O=l;if((e==="matchLeftIncl"||e==="matchRight")&&(O+=1),e[5]==="L")for(let b=O;b--;){let d=r[b];if((!i.trimBeforeMatching||i.trimBeforeMatching&&(d!=null&&d.trim()))&&(!((c=i.trimCharsBeforeMatching)!=null&&c.length)||d!==void 0&&!i.trimCharsBeforeMatching.includes(d))){$=b;break}}else if(e.startsWith("matchRight"))for(let b=O;b<r.length;b++){let d=r[b];if((!i.trimBeforeMatching||i.trimBeforeMatching&&d.trim())&&(!((y=i.trimCharsBeforeMatching)!=null&&y.length)||!i.trimCharsBeforeMatching.includes(d))){$=b;break}}if($===void 0)return!1;let C=r[$],T=$+1,p="";return T&&T>0&&(p=r.slice(0,T)),e[5]==="L"||$&&$>0&&(p=r.slice($)),i.cb(C,p,$)}let h="";throw a||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat(h))}for(let h=0,$=u.length;h<$;h++){s=typeof u[h]=="function";let O=u[h],C,T,p="",b=l;e==="matchRight"?b+=1:e==="matchLeft"&&(b-=1);let d=ze(r,b,O,i,s,D=>e[5]==="L"?D-1:D+1);if(d&&s&&typeof O=="function"&&O()==="EOL")return O()&&(!i.cb||i.cb(C,p,T))?O():!1;if(Number.isInteger(d)&&(T=e.startsWith("matchLeft")?d-1:d+1,e[5]==="L"?p=r.slice(0,d):p=r.slice(T)),T<0&&(T=void 0),r[T]&&(C=r[T]),Number.isInteger(d)&&(!i.cb||i.cb(C,p,T)))return O}return!1}function De(e,r,l,t){return re("matchLeft",e,r,l,t)}function ie(e,r,l,t){return re("matchRightIncl",e,r,l,t)}function J(e,r,l,t){return re("matchRight",e,r,l,t)}var Qe={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function K(e){var s,g;let r=/^[0-9a-zA-Z]+$/;function l(o){return S(o)&&!o.trim()}if(M(e)){if(!Object.keys(e).length)throw new Error('string-range-expander: [THROW_ID_02] Input must be a plain object but it\'s been given as a plain object without any keys. However, "from" and "to" settings are obligatory!')}else{let o;throw e===void 0?o="but it is missing completely.":e===null?o="but it was given as null.":o="but it was given as ".concat(typeof e,", equal to:\n").concat(JSON.stringify(e,null,4),"."),new Error("string-range-expander: [THROW_ID_01] Input must be a plain object ".concat(o))}if(!R(e.from))throw new Error("string-range-expander: [THROW_ID_03] The input's \"from\" value resolvedOpts.from, is not a number! It's been given as ".concat(typeof e.from,", equal to ").concat(JSON.stringify(e.from,null,0)));if(!R(e.to))throw new Error("string-range-expander: [THROW_ID_04] The input's \"to\" value resolvedOpts.to, is not a number! It's been given as ".concat(typeof e.to,", equal to ").concat(JSON.stringify(e.to,null,0)));if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error('string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("'.concat(e.str,'") must contain the character at index "from" ("').concat(e.from,'")'));if(e!=null&&e.str&&!e.str[e.to-1])throw new Error('string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("'.concat(e.str,'") must contain the character at index before "to" ("').concat(e.to-1,'")'));if(e.from>e.to)throw new Error('string-range-expander: [THROW_ID_07] The given "from" index, "'.concat(e.from,'" is greater than "to" index, "').concat(e.to,"\". That's wrong!"));if(e.extendToOneSide===null||S(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!S(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide)throw new Error('string-range-expander: [THROW_ID_08] The options value "extendToOneSide" is not recognisable! It\'s set to: "'.concat(e.extendToOneSide,'" (').concat(typeof e.extendToOneSide,'). It has to be either Boolean "false" or one of strings: "left" or "right"'));if(e!=null&&e.ifLeftSideIncludesThisThenCropTightly&&!S(e.ifLeftSideIncludesThisThenCropTightly))throw new Error('string-range-expander: [THROW_ID_09] The option "ifLeftSideIncludesThisThenCropTightly", is not a string! It\'s been given as '.concat(typeof e.ifLeftSideIncludesThisThenCropTightly,", equal to ").concat(JSON.stringify(e.ifLeftSideIncludesThisThenCropTightly,null,0)));if(e!=null&&e.ifLeftSideIncludesThisCropItToo&&!S(e.ifLeftSideIncludesThisCropItToo))throw new Error('string-range-expander: [THROW_ID_10] The option "ifLeftSideIncludesThisCropItToo", is not a string! It\'s been given as '.concat(typeof e.ifLeftSideIncludesThisCropItToo,", equal to ").concat(JSON.stringify(e.ifLeftSideIncludesThisCropItToo,null,0)));if(e!=null&&e.ifRightSideIncludesThisThenCropTightly&&!S(e.ifRightSideIncludesThisThenCropTightly))throw new Error('string-range-expander: [THROW_ID_11] The option "ifRightSideIncludesThisThenCropTightly", is not a string! It\'s been given as '.concat(typeof e.ifRightSideIncludesThisThenCropTightly,", equal to ").concat(JSON.stringify(e.ifRightSideIncludesThisThenCropTightly,null,0)));if(e!=null&&e.ifRightSideIncludesThisCropItToo&&!S(e.ifRightSideIncludesThisCropItToo))throw new Error('string-range-expander: [THROW_ID_12] The option "ifRightSideIncludesThisCropItToo", is not a string! It\'s been given as '.concat(typeof e.ifRightSideIncludesThisCropItToo,", equal to ").concat(JSON.stringify(e.ifRightSideIncludesThisCropItToo,null,0)));let t=w(w({},Qe),e),a=t.str,i=t.from,u=t.to;if(t.extendToOneSide!=="right"&&(l(a[i-1])&&(l(a[i-2])||t.ifLeftSideIncludesThisCropItToo.includes(a[i-2]))||a[i-1]&&t.ifLeftSideIncludesThisCropItToo.includes(a[i-1])||t.wipeAllWhitespaceOnLeft&&l(a[i-1]))){for(let o=i;o--;)if(!t.ifLeftSideIncludesThisCropItToo.includes(a[o])){if(a[o].trim()){t.wipeAllWhitespaceOnLeft||t.ifLeftSideIncludesThisCropItToo.includes(a[o+1])?i=o+1:i=o+2;break}else if(o===0){t.wipeAllWhitespaceOnLeft?i=0:i=1;break}}}if(t.extendToOneSide!=="left"&&(l(a[u])&&(t.wipeAllWhitespaceOnRight||l(a[u+1]))||t.ifRightSideIncludesThisCropItToo.includes(a[u]))){for(let o=u,m=a.length;o<m;o++)if(!t.ifRightSideIncludesThisCropItToo.includes(a[o])){if(a[o].trim()){t.wipeAllWhitespaceOnRight||t.ifRightSideIncludesThisCropItToo.includes(a[o-1])?u=o:u=o-1;break}else if(o===a.length-1){t.wipeAllWhitespaceOnRight?u=a.length:u=a.length-1;break}}}return(t.extendToOneSide!=="right"&&S(t.ifLeftSideIncludesThisThenCropTightly)&&t.ifLeftSideIncludesThisThenCropTightly&&(a[i-2]&&t.ifLeftSideIncludesThisThenCropTightly.includes(a[i-2])||a[i-1]&&t.ifLeftSideIncludesThisThenCropTightly.includes(a[i-1]))||t.extendToOneSide!=="left"&&S(t.ifRightSideIncludesThisThenCropTightly)&&t.ifRightSideIncludesThisThenCropTightly&&(a[u+1]&&t.ifRightSideIncludesThisThenCropTightly.includes(a[u+1])||a[u]&&t.ifRightSideIncludesThisThenCropTightly.includes(a[u])))&&(t.extendToOneSide!=="right"&&l(a[i-1])&&!t.wipeAllWhitespaceOnLeft&&(i-=1),t.extendToOneSide!=="left"&&l(a[u])&&!t.wipeAllWhitespaceOnRight&&(u+=1)),t.addSingleSpaceToPreventAccidentalConcatenation&&((s=a[i-1])!=null&&s.trim())&&((g=a[u])!=null&&g.trim())&&(!t.ifLeftSideIncludesThisThenCropTightly&&!t.ifRightSideIncludesThisThenCropTightly||!((!t.ifLeftSideIncludesThisThenCropTightly||t.ifLeftSideIncludesThisThenCropTightly.includes(a[i-1]))&&(!t.ifRightSideIncludesThisThenCropTightly||a[u]&&t.ifRightSideIncludesThisThenCropTightly.includes(a[u]))))&&(r.test(a[i-1])||r.test(a[u]))?[i,u," "]:[i,u]}var Ae=fe(ne(),1);var Vt=(0,Ae.default)();var B="\xA0";function Xe({str:e,idx:r=0,stopAtNewlines:l=!1,stopAtRawNbsp:t=!1}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),!e[r+1]))return null;if(e[r+1]&&(e[r+1].trim()||l&&"\n\r".includes(e[r+1])||t&&e[r+1]===B))return r+1;if(e[r+2]&&(e[r+2].trim()||l&&"\n\r".includes(e[r+2])||t&&e[r+2]===B))return r+2;for(let a=r+1,i=e.length;a<i;a++)if(e[a].trim()||l&&"\n\r".includes(e[a])||t&&e[a]===B)return a;return null}function L(e,r=0){return Xe({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ze({str:e,idx:r,stopAtNewlines:l,stopAtRawNbsp:t}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),r<1))return null;if(e[~-r]&&(e[~-r].trim()||l&&"\n\r".includes(e[~-r])||t&&e[~-r]===B))return~-r;if(e[r-2]&&(e[r-2].trim()||l&&"\n\r".includes(e[r-2])||t&&e[r-2]===B))return r-2;for(let a=r;a--;)if(e[a]&&(e[a].trim()||l&&"\n\r".includes(e[a])||t&&e[a]===B))return a;return null}function z(e,r=0){return Ze({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ie="6.1.3";var tt=Ie,E=new Oe({limitToBeAddedWhitespace:!0}),Ce={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function nt(e,r){var ue,ae;let l=Date.now();if(!S(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error('html-crush: [THROW_ID_02] the first input argument must be string! It was given as "'.concat(typeof e,'", equal to:\n').concat(JSON.stringify(e,null,4)));if(r&&!M(r))throw new Error("html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ".concat(typeof r,", equal to ").concat(JSON.stringify(r,null,4)));if(r&&Array.isArray(r.breakToTheLeftOf)&&r.breakToTheLeftOf.length){for(let n=0,U=r.breakToTheLeftOf.length;n<U;n++)if(!S(r.breakToTheLeftOf[n]))throw new TypeError("html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ".concat(n,' is of a type "').concat(typeof r.breakToTheLeftOf[n],'" and is equal to:\n').concat(JSON.stringify(r.breakToTheLeftOf[n],null,4)))}let t=w(w({},Ce),r);typeof t.removeHTMLComments=="boolean"&&(t.removeHTMLComments=t.removeHTMLComments?1:0);let a="";Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length&&(a=[...new Set(t.breakToTheLeftOf.map(n=>n[0]))].join(""));let i={removeHTMLComments:!1,removeCSSComments:!1},u=null,s=null,g=!1,o=0,m=0,c=!1,y=!1,h=null,$=null,O=null,C=null,T,p=null,b=null,d=null,D=null,N=null,v=null,V=">};",j="<",Ne="!",ve=">",Re="<",oe="{},:;<>~+",Q=oe,X=oe,_=!0,I=e.length,Ve=Math.floor(I/2),se=.01,le;t.reportProgressFunc&&(le=Math.floor(t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*se-t.reportProgressFuncFrom));let H,q=0,A="\n";if(e.includes("\r\n")?A="\r\n":e.includes("\r")&&(A="\r"),I){for(let n=0;n<I;n++){if(t.reportProgressFunc&&(I>1e3&&I<2e3?n===Ve&&t.reportProgressFunc(Math.floor((t.reportProgressFuncTo-t.reportProgressFuncFrom)/2)):I>=2e3&&(H=t.reportProgressFuncFrom+Math.floor(n/I*(le||1)),H!==q&&(q=H,t.reportProgressFunc(H)))),m++,!T&&c&&e[n]==="}"&&e[n-1]==="}"&&(o+1>=t.lineLengthLimit?(E.push(n,n,A),o=0):(p=n,b=n,d=" ")),T&&typeof T=="number"&&n>=T&&(T=void 0),C!==null&&e.startsWith("<\/script",n)&&!F(e[n+8])){if((t.removeIndentations||t.removeLineBreaks)&&n>0&&e[~-n]&&!e[~-n].trim()){for(let f=n;f--;)if(e[f]==="\n"||e[f]==="\r"||e[f].trim()){f+1<n&&E.push(f+1,n);break}}C=null,T=!1,n+=8;continue}if(!T&&!c&&e.startsWith("<script",n)&&!F(e[n+7])){C=n,T=!0;let f="";(t.removeLineBreaks||t.removeIndentations)&&s!==null&&(s>0&&(f=A),E.push(s,n,f)),s=null,u=null}if(N!==null&&D===null&&!/\w/.test(e[n])){D=e.slice(N,n);let f=L(e,~-n);typeof f=="number"&&e[f]===">"&&!e[n].trim()&&L(e,n)?E.push(n,L(e,n)):f&&e[f]==="/"&&e[L(e,f)]===">"&&(!e[n].trim()&&L(e,n)&&E.push(n,L(e,n)),e[f+1]!==">"&&L(e,f+1)&&E.push(f+1,L(e,f+1)))}if(!T&&!c&&!h&&e[~-n]==="<"&&N===null&&(/\w/.test(e[n])?N=n:e[L(e,~-n)]==="/"&&/\w/.test(e[L(e,L(e,~-n))]||"")&&(N=L(e,L(e,~-n)))),!T&&(c||h)&&$!==null&&e[n]==="*"&&e[n+1]==="/"&&([p,b]=K({str:e,from:$,to:n+2,ifLeftSideIncludesThisThenCropTightly:Q||"",ifRightSideIncludesThisThenCropTightly:X||""}),$=null,p!=null?E.push(p,b):(o+=1,n+=1),T=n+2),!T&&(c||h)&&$===null&&e[n]==="/"&&e[n+1]==="*"&&(i.removeCSSComments||(i.removeCSSComments=!0),t.removeCSSComments&&($=n)),y&&e.startsWith("![endif",n+1)&&(y=!1),!T&&!c&&!h&&O!==null){let f;e.startsWith("-->",n)?f=3:e[n]===">"&&e[n-1]==="]"&&(f=1),f&&([p,b]=K({str:e,from:O,to:n+f}),O=null,p!=null?t.lineLengthLimit&&m-(b-p)>=t.lineLengthLimit?(E.push(p,b,A),m=-f):(E.push(p,b),m-=b-p):(o+=f-1,n+=f-1),T=n+f)}if(!T&&!c&&!h&&(e.startsWith("<!--",n)||t.removeHTMLComments===2&&e.startsWith("<![endif",n))&&O===null&&(e.startsWith("[if",n+4)?(y||(y=!0),t.removeHTMLComments===2&&(O=n)):t.removeHTMLComments&&(!y||t.removeHTMLComments===2)&&(O=n),i.removeHTMLComments||(i.removeHTMLComments=!0)),!T&&c&&$===null&&e.startsWith("</style",n)&&!F(e[n+7])?c=!1:!T&&!c&&$===null&&e.startsWith("<style",n)&&!F(e[n+6])&&(c=!0,(t.removeLineBreaks||t.removeIndentations)&&t.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',n+6)&&e[n+24]&&E.push(n+23,n+23,A)),!T&&!h&&"\"'".includes(e[n])&&e.endsWith("style=",n)&&(h=n),!T&&!e[n].trim())s===null&&(s=n);else if(!T&&!((c||h)&&$!==null)){if(s!==null){if(t.removeLineBreaks&&(o+=1),_)_=!1,(t.removeIndentations||t.removeLineBreaks)&&E.push(0,n);else if(t.removeIndentations&&!t.removeLineBreaks&&(!g&&u!==null&&n>u?E.push(u+1,n):s+1<n&&(e.endsWith("]>",s)||e.endsWith("-->",s)||e.startsWith("<![",n)||e.startsWith("<!--<![",n)?E.push(s,n):e[s]===" "?E.push(s+1,n):e[~-n]===" "?E.push(s,~-n):E.push(s,n," "))),t.removeLineBreaks||h){if(a.includes(e[n])&&ie(e,n,t.breakToTheLeftOf)){!("\r\n".includes(e[~-n])&&s===~-n)&&!(e[~-n]==="\n"&&e[n-2]==="\r"&&s===n-2)&&E.push(s,n,A),p=null,b=null,d=null,s=null,o=1;continue}let f=" ";e[n]==="<"&&J(e,n,t.mindTheInlineTags,{cb:x=>!x||!/\w/.test(x)})||(e[~-s]&&ve.includes(e[~-s])&&Re.includes(e[n])||(c||h)&&$===null&&(Q.includes(e[~-s])||X.includes(e[n]))||e.startsWith("!important",n)&&!y||h&&(e[~-s]==="'"||e[~-s]==='"')||e[~-s]==="}"&&e.startsWith("</style",n)||e[n]===">"&&("'\"".includes(e[z(e,n)])||e[L(e,n)]==="<")||e[n]==="/"&&e[L(e,n)]===">")&&(f="",e[n]==="/"&&e[n+1]===">"&&L(e,n)&&L(e,n)>n+1&&(E.push(n+1,L(e,n)),o-=L(e,n)-n+1)),c&&e[n]==="}"&&s&&e[s-1]==="}"&&(f=" "),f!=null&&f.length&&(o+=1),t.lineLengthLimit?o>=t.lineLengthLimit||!e[n+1]||e[n]===">"||e[n]==="/"&&e[n+1]===">"?((o>t.lineLengthLimit||o===t.lineLengthLimit&&((ue=e[n+1])!=null&&ue.trim())&&!V.includes(e[n])&&!j.includes(e[n+1]))&&(f=A,o=1),(o>t.lineLengthLimit||!(f===" "&&n===s+1))&&(E.push(s,n,f),u=null),p=null,b=null,d=null):(p===null||s<p)&&(p=s,b=n,d=f):n===s+1&&f===" "||E.push(s,n,f)}s=null,g||(g=!0)}else _&&(_=!1),t.removeLineBreaks&&(o+=1);g||(g=!0)}if(!T&&!_&&n!==0&&t.removeLineBreaks&&(t.lineLengthLimit||a)&&!e.startsWith("</a",n)){if(a&&ie(e,n,t.breakToTheLeftOf)&&e.slice(0,n).trim()&&(!e.startsWith("<![endif]",n)||!De(e,n,"<!--"))){E.push(n,n,A),p=null,b=null,d=null,o=1;continue}else if(t.lineLengthLimit&&o<=t.lineLengthLimit){if(!e[n+1]||j.includes(e[n])&&!Ne.includes(e[n])||V.includes(e[n])||!e[n].trim()){if(p!==null&&b!==null&&(p!==b||d!=null&&d.length)){let f=d;e[n].trim()&&((ae=e[n+1])!=null&&ae.trim())&&o+(d?d.length:0)>t.lineLengthLimit&&(f=A),(o+(f?f.length:0)>t.lineLengthLimit||!(f===" "&&b===p+1&&e[p]===" "))&&(e[~-p]==="}"&&e[b]==="{"||(E.push(p,b,f),u=null))}e[n].trim()&&(j.includes(e[n])||e[~-n]&&V.includes(e[~-n]))&&S(v)&&(!D||!t.mindTheInlineTags.includes(D))&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{cb:f=>!f||!/\w/.test(f)}))&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:f=>!f||!/\w/.test(f)}))?(p=n,b=n,d=null):$===null&&p!==null&&(h||!t.mindTheInlineTags||!Array.isArray(t.mindTheInlineTags)||Array.isArray(t.mindTheInlineTags.length)&&!t.mindTheInlineTags.length||!S(D)||Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&S(D)&&!t.mindTheInlineTags.includes(D))&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:f=>!f||!/\w/.test(f)}))&&(p=null,b=null,d=null)}}else if(t.lineLengthLimit)if(j.includes(e[n])&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:f=>!f||!/\w/.test(f)})))if(p!==null&&b!==null&&(p!==b||d!=null&&d.length)){let f=d!=null&&d.length?d.length:0;o-(b-p-f)-1>t.lineLengthLimit||(E.push(p,b,d),o-(b-p-f)-1===t.lineLengthLimit&&(E.push(n,n,A),o=0),p=null,b=null,d=null)}else E.push(n,n,A),o=0;else e[n+1]&&V.includes(e[n])&&S(D)&&Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&!t.mindTheInlineTags.includes(D)?p!==null&&b!==null&&(p!==b||d!=null&&d.length)||(E.push(n+1,n+1,A),o=0):e[n].trim()&&(e[n+1]||p!==null&&b!==null&&(p!==b||d!=null&&d.length)&&E.push(p,b,A))}if(!T&&!_&&t.removeLineBreaks&&t.lineLengthLimit&&o>=t.lineLengthLimit&&p!==null&&b!==null&&!V.includes(e[n])&&!j.includes(e[n])&&!"/".includes(e[n])&&!(o===t.lineLengthLimit&&e[n+1]&&!e[n+1].trim())){let f=A;e[n+1]&&!e[n+1].trim()&&o===t.lineLengthLimit&&(f=d),f===A&&!e[~-p].trim()&&z(e,p)&&(p=z(e,p)+1),E.push(p,b,f),o=n-b,e[n].length&&(o+=1),p=null,b=null,d=null}if((!T&&e[n]==="\n"||e[n]==="\r"&&(!e[n+1]||e[n+1]&&e[n+1]!=="\n"))&&(u=n,g&&(g=!1),!t.removeLineBreaks&&s!==null&&s<n&&e[n+1]&&e[n+1]!=="\r"&&e[n+1]!=="\n"&&E.push(s,n)),e[n+1]||(c&&$!==null?E.push([...K({str:e,from:$,to:n,ifLeftSideIncludesThisThenCropTightly:Q||"",ifRightSideIncludesThisThenCropTightly:X||""})]):s&&e[n]!=="\n"&&e[n]!=="\r"?E.push(s,n+1):s&&(e[n]==="\r"&&e[n+1]==="\n"||e[n]==="\n"&&e[n-1]!=="\r")&&E.push(s,n)),!T&&h&&h<n&&e[h]===e[n]&&(h=null),!T&&!c&&e.startsWith("<pre",n)&&!F(e[n+4])){let f=e.indexOf("</pre",n+5);f>0&&(T=f)}if(!T&&!c&&e.startsWith("<code",n)&&!F(e[n+5])){let f=e.indexOf("</code",n+5);f>0&&(T=f)}if(!T&&e.startsWith("<![CDATA[",n)){let f=e.indexOf("]]>",n+9);f>0&&(T=f)}!T&&!c&&!h&&N!==null&&e[n]===">"&&(e[L(e,n)]==="<"&&(v=D),N=null,D=null),e[n]==="<"&&v!==null&&(v=null),c&&e[n]==="{"&&e[n+1]==="{"&&e.indexOf("}}")!==-1&&(T=e.indexOf("}}")+2);let U=!0}if(E.current()){let n=E.current();E.wipe();let U=t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*se,f=de(e,n,Me=>{t.reportProgressFunc&&I>=2e3&&(H=Math.floor(U+(t.reportProgressFuncTo-U)*(Me/100)),H!==q&&(q=H,t.reportProgressFunc(H)))}),x=f.length;return{log:{timeTakenInMilliseconds:Date.now()-l,originalLength:I,cleanedLength:x,bytesSaved:Math.max(I-x,0),percentageReducedOfOriginal:I?Math.round(Math.max(I-x,0)*100/I):0},ranges:n,applicableOpts:i,result:f}}}return{log:{timeTakenInMilliseconds:Date.now()-l,originalLength:I,cleanedLength:I,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:i,ranges:null,result:e}}return Je(rt);})();
|
|
10
|
+
"use strict";var htmlCrush=(()=>{var Y=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames,he=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable;var re=(e,r,l)=>r in e?Y(e,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[r]=l,L=(e,r)=>{for(var l in r||(r={}))me.call(r,l)&&re(e,l,r[l]);if(he)for(var l of he(r))Ne.call(r,l)&&re(e,l,r[l]);return e};var Ve=(e,r)=>{for(var l in r)Y(e,l,{get:r[l],enumerable:!0})},Me=(e,r,l,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Re(r))!me.call(e,o)&&o!==l&&Y(e,o,{get:()=>r[o],enumerable:!(n=ve(r,o))||n.enumerable});return e};var Pe=e=>Me(Y({},"__esModule",{value:!0}),e);var J=(e,r,l)=>re(e,typeof r!="symbol"?r+"":r,l);var et={};Ve(et,{crush:()=>Ze,defaults:()=>Oe,version:()=>Xe});function xe(){let e=[],r=0,l=!1;return{append(n){return l?!1:r+n.length>1999?(e.push("\u2026"),r+=1,l=!0,!1):(e.push(n),r+=n.length,!0)},result(){return e.join("")},stopped(){return l}}}function _e(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function z(e,r){if(e.append('"')){for(let l=0;l<r.length&&!e.stopped();l+=1){let n=r.charCodeAt(l);n===34?e.append('\\"'):n===92?e.append("\\\\"):n===8?e.append("\\b"):n===9?e.append("\\t"):n===10?e.append("\\n"):n===12?e.append("\\f"):n===13?e.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?e.append(_e(n)):e.append(r[l])}e.append('"')}}function He(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function $e(e,r){e.append("Symbol(");let l=String(r);l.length>8&&z(e,l.slice(7,-1)),e.append(")")}function ce(e,r){typeof r=="symbol"?$e(e,r):z(e,String(r))}function T(e,r=0){let l=xe(),n=r===4?4:0,o=new WeakSet,i=0;function f(u){n&&l.append(" ".repeat(u*n))}function g(u,d){u&&l.append(","),n&&(l.append("\n"),f(d+1))}function a(u,d,O){n&&d&&(l.append("\n"),f(O)),l.append(u)}function s(u,d){Object.prototype.hasOwnProperty.call(u,"value")?p(u.value,d):l.append(He(u))}function c(u,d){let O;try{O=Reflect.getOwnPropertyDescriptor(u,"length")}catch(m){l.append("[Uninspectable]");return}let S=O==null?void 0:O.value;if(!Number.isSafeInteger(S)||S<0){l.append("[Uninspectable]");return}l.append("[");let b=!1;for(let m=0;m<S&&!l.stopped();m+=1){if(g(b,d),b=!0,i>=50){l.append("[MaxEntries]");break}i+=1;let $;try{$=Reflect.getOwnPropertyDescriptor(u,String(m))}catch(y){l.append("[Uninspectable]");continue}$!=null&&$.enumerable?s($,d+1):l.append("[Empty]")}a("]",b,d)}function w(u,d){let O;try{O=Reflect.ownKeys(u)}catch(b){l.append("[Uninspectable]");return}l.append("{");let S=!1;for(let b of O){if(l.stopped())break;if(i>=50){g(S,d),S=!0,z(l,"\u2026"),l.append(n?": ":":"),l.append("[MaxEntries]");break}i+=1;let m;try{m=Reflect.getOwnPropertyDescriptor(u,b)}catch($){g(S,d),S=!0,ce(l,b),l.append(n?": ":":"),l.append("[Uninspectable]");continue}m!=null&&m.enumerable&&(g(S,d),S=!0,ce(l,b),l.append(n?": ":":"),s(m,d+1))}a("}",S,d)}function E(u,d){if(o.has(u)){l.append("[Circular]");return}if(d>=5){l.append("[MaxDepth]");return}let O;try{O=Array.isArray(u)}catch(S){l.append("[Uninspectable]");return}o.add(u);try{O?c(u,d):w(u,d)}finally{o.delete(u)}}function p(u,d){u===null?l.append("null"):typeof u=="string"?z(l,u):typeof u=="number"?l.append(Object.is(u,-0)?"-0":String(u)):typeof u=="boolean"?l.append(u?"true":"false"):typeof u>"u"?l.append("undefined"):typeof u=="bigint"?l.append("".concat(u,"n")):typeof u=="symbol"?$e(l,u):typeof u=="function"?l.append("[Function]"):E(u,d)}try{return p(e,0),l.result()}catch(u){return"[Uninspectable]"}}var nt=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]),Fe=Object.prototype.hasOwnProperty;function H(e){if(!D(e)||e.length!==1)return!1;let r=e.charCodeAt(0);return r<128?r>64&&r<91||r>96&&r<123:e.toUpperCase()!==e.toLowerCase()}function M(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function D(e){return typeof e=="string"}function pe(e){return Number.isFinite(e)}function V(e){return Number.isSafeInteger(e)&&e>=0}function P(e){return e!=null}function de(e,r){return M(e)&&D(r)&&Fe.call(e,r)}var We={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function W(e,r){if(!Array.isArray(e)||!e.length)return e;let l=L(L({},We),r),n,o;if(l.strictlyTwoElementsInRangeArrays&&!e.every((g,a)=>!Array.isArray(g)||g.length!==2?(n=a,o=g.length,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(n,"th range (").concat(T(e[n],4),") has not two but ").concat(o," elements!"));if(!e.every((g,a)=>!Array.isArray(g)||!Number.isInteger(g[0])||g[0]<0||!Number.isInteger(g[1])||g[1]<0?(n=a,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(n,"th range (").concat(T(e[n],4),") does not consist of only natural numbers!"));let i=e.length**2,f=0;return Array.from(e).sort((g,a)=>(l.progressFn&&(f+=1,l.progressFn(Math.floor(f*100/i))),g[0]===a[0]?g[1]<a[1]?-1:g[1]>a[1]?1:0:g[0]<a[0]?-1:1))}var ke={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ie(e,r){function l(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;if(r&&!l(r))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(T(r,4)," (type ").concat(typeof r,")"));let n=L(L({},ke),r);if(n.progressFn&&l(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof n.progressFn,'", equal to ').concat(T(n.progressFn,4)));if(![1,2,"1","2"].includes(n.mergeType))throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof n.mergeType,'", equal to ').concat(T(n.mergeType,4)));if(typeof n.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof n.joinRangesThatTouchEdges,'", equal to ').concat(T(n.joinRangesThatTouchEdges,4)));let o=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),i,f,g;n.progressFn?i=W(o,{progressFn:s=>{g=Math.floor(s/5),g!==f&&(f=g,n.progressFn(g))}}):i=W(o);let a=i.length-1;for(let s=a;s>0;s--)n.progressFn&&(g=Math.floor((1-s/a)*78)+21,g!==f&&g>f&&(f=g,n.progressFn(g))),(i[s][0]<=i[s-1][0]||!n.joinRangesThatTouchEdges&&i[s][0]<i[s-1][1]||n.joinRangesThatTouchEdges&&i[s][0]<=i[s-1][1])&&(i[s-1][0]=Math.min(i[s][0],i[s-1][0]),i[s-1][1]=Math.max(i[s][1],i[s-1][1]),i[s][2]!==void 0&&(i[s-1][0]>=i[s][0]||i[s-1][1]<=i[s][1])&&i[s-1][2]!==null&&(i[s][2]===null&&i[s-1][2]!==null?i[s-1][2]=null:i[s-1][2]!=null?+n.mergeType==2&&i[s-1][0]===i[s][0]?i[s-1][2]=i[s][2]:i[s-1][2]+=i[s][2]:i[s-1][2]=i[s][2]),i.splice(s,1),s=i.length);return i.length?i:null}function K(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let r=Number(e);return Number.isInteger(r)&&r>=0}function be(e,r,l){let n=0,o=0;if(e===void 0&&r===void 0&&l===void 0)throw new Error("ranges-apply/rApply(): [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply/rApply(): [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(T(e,4)));if(r!=null&&!Array.isArray(r))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof r,", equal to: ").concat(T(r,4)));if(l&&typeof l!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function (or falsy)! Currently it's: ".concat(typeof l,", equal to: ").concat(T(l,4)));if(!(r!=null&&r.some(Boolean)))return e;let i;Array.isArray(r)&&!Array.isArray(r[0])&&K(r[0])&&K(r[1])?i=[Array.from(r)]:i=Array.from(r);let f=i.length,g=0;i.forEach((c,w)=>{if(c){if(l&&(n=Math.floor(g/f*10),n!==o&&(o=n,l(n))),!Array.isArray(c))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(w,"th element not an array: ").concat(T(c,4),", which is ").concat(typeof c));if(!K(c[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(w,"th element, array ").concat(T(c),". Its first element is not a non-negative integer or string index, but ").concat(typeof c[0],", equal to: ").concat(T(c[0],4),"."));if(typeof c[0]=="string"&&(i[w]=[...c],i[w][0]=Number(c[0])),!K(c[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(w,"th element, array ").concat(T(c),". Its second element is not a non-negative integer or string index, but ").concat(typeof c[1],", equal to: ").concat(T(c[1],4),"."));typeof c[1]=="string"&&(i[w]===c&&(i[w]=[...c]),i[w][1]=Number(c[1])),g+=1}});let a=l?ie(i,{progressFn:c=>{n=10+Math.floor(c/10),n!==o&&(o=n,l(n))}}):ie(i),s=(a==null?void 0:a.length)||0;if(a&&s>0){let c=e.slice(a[s-1][1]);e=a.reduce((w,E,p,u)=>{l&&(n=20+Math.floor(p/s*80),n!==o&&(o=n,l(n)));let d=p===0?0:u[p-1][1],O=u[p][0];return"".concat(w).concat(e.slice(d,O)).concat(u[p][2]||"")},""),e+=c}return e}function Q(e,r=1){let l="\xA0";function n(i){return Array.from(i).reverse().join("")}function o(i,f,g){let a=g?"\n":"\r",s=g?"\r":"\n";if(!i)return i;let c=0,w=0,E="";for(let p=0,u=i.length;p<u;p++)(i[p]===a||i[p]===s&&i[p-1]!==a)&&w++,"\r\n".includes(i[p])||i[p]===l?(c=0,i[p]===l?E+=i[p]:i[p]===a?w<=f&&(E+=i[p],i[p+1]===s&&(E+=i[p+1],p++)):i[p]===s&&(i==null?void 0:i[p-1])!==a&&w<=f&&(E+=i[p])):(c++,!i[p+1]&&!w&&(E+=" "));return E}if(typeof e=="string"&&e.length){let i=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(i=+r);let f="",g="";if(!e.trim())f=e;else if(!e[0].trim()){for(let a=0,s=e.length;a<s;a++)if(e[a].trim()){f=e.slice(0,a);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===l)){for(let a=e.length;a--;)if(e[a].trim()){g=e.slice(a+1);break}}return"".concat(o(f,i,!1)).concat(e.trim()).concat(n(o(n(g),i,!0)))}return e}var Be={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ue(e,r){function l(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;if(r&&!l(r))throw new TypeError("ranges-push/rMerge(): [THROW_ID_10] the second input argument must be a plain object. It was given as:\n".concat(T(r,4)," (type ").concat(typeof r,")"));let n=L(L({},Be),r);if(n.progressFn&&l(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_11] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof n.progressFn,'", equal to ').concat(T(n.progressFn,4)));if(![1,2,"1","2"].includes(n.mergeType))throw new TypeError('ranges-push/rMerge(): [THROW_ID_12] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof n.mergeType,'", equal to ').concat(T(n.mergeType,4)));if(typeof n.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_13] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof n.joinRangesThatTouchEdges,'", equal to ').concat(T(n.joinRangesThatTouchEdges,4)));let o=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),i,f,g;n.progressFn?i=W(o,{progressFn:s=>{g=Math.floor(s/5),g!==f&&(f=g,n.progressFn!=null&&n.progressFn(g))}}):i=W(o);let a=i.length-1;for(let s=a;s>0;s--)n.progressFn&&(g=Math.floor((1-s/a)*78)+21,g!==f&&g>f&&(f=g,n.progressFn(g))),(i[s][0]<=i[s-1][0]||!n.joinRangesThatTouchEdges&&i[s][0]<i[s-1][1]||n.joinRangesThatTouchEdges&&i[s][0]<=i[s-1][1])&&(i[s-1][0]=Math.min(i[s][0],i[s-1][0]),i[s-1][1]=Math.max(i[s][1],i[s-1][1]),i[s][2]!==void 0&&(i[s-1][0]>=i[s][0]||i[s-1][1]<=i[s][1])&&i[s-1][2]!==null&&(i[s][2]===null&&i[s-1][2]!==null?i[s-1][2]=null:i[s-1][2]!=null?+n.mergeType==2&&i[s-1][0]===i[s][0]?i[s-1][2]=i[s][2]:i[s-1][2]+=i[s][2]:i[s-1][2]=i[s][2]),i.splice(s,1),s=i.length);return i.length?i:null}var je={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1};function Te(e){return e[2]===void 0&&e[0]===e[1]}function Je(e){let r=-1;for(let l=0,n=e.length;l<n;l++){let o=e[l];if(Array.isArray(o)){if(o[0]<r)return!1;r=o[0]}}return!0}var ye=class{constructor(e){J(this,"ranges");J(this,"opts");J(this,"sorted");if(e!=null&&!M(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(T(e,4)," (type ").concat(typeof e,")."));let r=L(L({},je),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(D(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(D(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error('ranges-push/Ranges/constructor(): [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(T(r.mergeType,4)));this.opts=r,this.ranges=[],this.sorted=!0}add(e,r,l){var i;if(e==null&&r==null)return;if(P(e)&&!P(r)){if(Array.isArray(e)){if(e.length){if(e.some(f=>Array.isArray(f))){e.forEach(f=>{Array.isArray(f)&&this.add(...f)});return}e.length&&V(+e[0])&&V(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_03] the first input argument, "from" is set ('.concat(T(e),') but second-one, "to" is not (').concat(T(r),")"))}else if(!P(e)&&P(r))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_04] the second input argument, "to" is set ('.concat(T(r),') but first-one, "from" is not (').concat(T(e),")"));let n=+e,o=+r;if(V(n)&&V(o)){if(P(l)&&!D(l)&&!pe(l))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_05] The third argument, the value to add, was given not as string but ".concat(typeof l,", equal to:\n").concat(T(l,4)));if(P(this.ranges)&&Array.isArray(this.last())&&n===this.last()[1]){if(this.last()[1]=o,this.last()[2],this.last()[2]!==null&&P(l)){let f=this.last()[2]&&this.last()[2].length&&(!((i=this.opts)!=null&&i.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(l):l;this.opts.limitToBeAddedWhitespace&&(f=Q(f,this.opts.limitLinebreaksCount)),D(f)&&!f.length||(this.last()[2]=f)}}else{this.ranges||(this.ranges=[]);let f=this.last();f&&n<f[0]&&(this.sorted=!1);let g=l!==void 0&&!(D(l)&&!l.length)?[n,o,l&&this.opts.limitToBeAddedWhitespace?Q(l,this.opts.limitLinebreaksCount):l]:[n,o];this.ranges.push(g)}}else throw V(n)?new TypeError('ranges-push/Ranges/add(): [THROW_ID_07] "to" value, the second input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof r,'" equal to: ').concat(T(r,4))):new TypeError('ranges-push/Ranges/add(): [THROW_ID_06] "from" value, the first input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof e,'" equal to: ').concat(T(e,4)))}push(e,r,l){this.add(e,r,l)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Ue(this.ranges,{mergeType:this.opts.mergeType}),this.sorted=!0,this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>P(e[2])?[e[0],e[1],Q(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}firstCovers(e){if(!V(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_08] the input argument must be a natural number or zero! It was given as ".concat(T(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let r=null;if(this.sorted){for(let n=0,o=this.ranges.length;n<o;n++){let i=this.ranges[n];if(!(!Array.isArray(i)||Te(i))){if(r===null){if(i[0]!==0)return!1;r=i[1]}else{if(i[0]>r)break;i[1]>r&&(r=i[1])}if(r>=e)return!0}}return r!==null&&r>=e}let l=!0;for(;l;){l=!1;for(let n=0,o=this.ranges.length;n<o;n++){let i=this.ranges[n];if(!(!Array.isArray(i)||Te(i))){if(i[0]<0)return!1;(r===null?i[0]===0:i[0]<=r&&i[1]>r)&&(r=i[1],l=!0)}}}return r!==null&&r>=e}wipe(){this.ranges=[],this.sorted=!0}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&V(e[0][0]))this.ranges=Array.from(e),this.sorted=Je(this.ranges);else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_09] Single range was given but we expected array of arrays! The first element, ".concat(T(e[0],4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[],this.sorted=!0}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var k="\xA0";function Ge({str:e,idx:r=0,stopAtNewlines:l=!1,stopAtRawNbsp:n=!1}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),!e[r+1]))return null;if(e[r+1]&&(e[r+1].trim()||l&&"\n\r".includes(e[r+1])||n&&e[r+1]===k))return r+1;if(e[r+2]&&(e[r+2].trim()||l&&"\n\r".includes(e[r+2])||n&&e[r+2]===k))return r+2;for(let o=r+1,i=e.length;o<i;o++)if(e[o].trim()||l&&"\n\r".includes(e[o])||n&&e[o]===k)return o;return null}function A(e,r=0){return Ge({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function qe({str:e,idx:r,stopAtNewlines:l,stopAtRawNbsp:n}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),r<1))return null;if(e[~-r]&&(e[~-r].trim()||l&&"\n\r".includes(e[~-r])||n&&e[~-r]===k))return~-r;if(e[r-2]&&(e[r-2].trim()||l&&"\n\r".includes(e[r-2])||n&&e[r-2]===k))return r-2;for(let o=r;o--;)if(e[o]&&(e[o].trim()||l&&"\n\r".includes(e[o])||n&&e[o]===k))return o;return null}function X(e,r=0){return qe({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ee(e){return typeof e!="string"?e:e.length?[e]:[]}var Se={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Ye=e=>e+1;function ze(e,r,l,n,o=!1,i=Ye){var m;let f=typeof l=="function"?l():l;if(+r<0&&o&&f==="EOL")return f;let g=L(L({},Se),n);if(r>=e.length&&!o)return!1;let a=o?1:l.length,s=0,c=!1,w=!1,E=!1,p=g.maxMismatches,u=r,d=!1,O=!1,S=!1;function b(){return s===1&&p<g.maxMismatches-1}for(;e[u];){let $=i(u);if(g.trimBeforeMatching&&e[u].trim()===""){if(!e[$]&&o&&l==="EOL")return!0;u=i(u);continue}if(g&&!g.i&&((m=g==null?void 0:g.trimCharsBeforeMatching)!=null&&m.includes(e[u]))||g!=null&&g.i&&g.trimCharsBeforeMatching&&g.trimCharsBeforeMatching.map(C=>C.toLowerCase()).includes(e[u].toLowerCase())){if(o&&l==="EOL"&&!e[$])return!0;u=i(u);continue}let y=$>u?l[l.length-a]:l[a-1];if(!g.i&&e[u]===y||g.i&&y!==void 0&&e[u].toLowerCase()===y.toLowerCase()){if(d||(d=!0),E||(E=!0),a===l.length){if(O=!0,p!==g.maxMismatches)return!1}else a===1&&(S=!0);if(a-=1,s++,b())return!1;if(!a)return s!==l.length||p===g.maxMismatches||!c?u:!1}else if(!c&&!s&&(c=!0),g.maxMismatches&&p&&u){p-=1;for(let C=0;C<=p;C++){let v=$>u?l[l.length-a+1+C]:l[a-2-C],x=e[i(u)];if(v&&(!g.i&&e[u]===v||g.i&&e[u].toLowerCase()===v.toLowerCase())&&(!g.firstMustMatch||a!==l.length)){if(s++,b())return!1;a-=2,d=!0;break}else if(x&&v&&(!g.i&&x===v||g.i&&x.toLowerCase()===v.toLowerCase())&&(!g.firstMustMatch||a!==l.length)){if(!s&&!g.hungry)return!1;a-=1,d=!0;break}else if(v===void 0&&p>=0&&d&&(!g.firstMustMatch||O)&&(!g.lastMustMatch||S))return u}d||(w=u)}else return u===0&&a===1&&!g.lastMustMatch&&E?0:!1;if(w!==!1&&w!==u&&(w=!1),a<1)return u;u=i(u)}if(a>0)return o&&f==="EOL"?!0:g&&g.maxMismatches>=a&&E?w||0:!1}function oe(e,r,l,n,o){var c,w,E;if(M(o)&&de(o,"trimBeforeMatching")&&o&&typeof o.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_01] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(o.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let i=L(L({},Se),o);if(typeof i.trimCharsBeforeMatching=="string"&&(i.trimCharsBeforeMatching=Ee(i.trimCharsBeforeMatching)),i.trimCharsBeforeMatching=i.trimCharsBeforeMatching.map(p=>D(p)?p:String(p)),!D(r)||!r.length)return!1;if(!Number.isInteger(l)||l<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_02] the second argument should be a natural number. Currently it's of a type: ").concat(typeof l,", equal to:\n").concat(T(l,4)));let f,g;if(D(n))f=[n];else if(Array.isArray(n))f=n;else if(!n)f=n;else if(typeof n=="function")f=[],f.push(n);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof n,", equal to:\n").concat(T(n,4)));if(o&&!M(o))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_04] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof o,'", and equal to:\n').concat(T(o,4)));let a=0,s="";if((c=i==null?void 0:i.trimCharsBeforeMatching)!=null&&c.some((p,u)=>p.length>1?(a=u,s=p,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(a," is longer than 1 character, ").concat(s.length," (equals to ").concat(s,"). Please split it into separate characters and put into array as separate elements."));if(!f||!Array.isArray(f)||Array.isArray(f)&&!f.length||Array.isArray(f)&&f.length===1&&D(f[0])&&!f[0].trim()){if(typeof i.cb=="function"){let u,d=l;if((e==="matchLeftIncl"||e==="matchRight")&&(d+=1),e[5]==="L")for(let m=d;m--;){let $=r[m];if((!i.trimBeforeMatching||i.trimBeforeMatching&&($!=null&&$.trim()))&&(!((w=i.trimCharsBeforeMatching)!=null&&w.length)||$!==void 0&&!i.trimCharsBeforeMatching.includes($))){u=m;break}}else if(e.startsWith("matchRight"))for(let m=d;m<r.length;m++){let $=r[m];if((!i.trimBeforeMatching||i.trimBeforeMatching&&$.trim())&&(!((E=i.trimCharsBeforeMatching)!=null&&E.length)||!i.trimCharsBeforeMatching.includes($))){u=m;break}}if(u===void 0)return!1;let O=r[u],S=u+1,b="";return S&&S>0&&(b=r.slice(0,S)),e[5]==="L"||u&&u>0&&(b=r.slice(u)),i.cb(O,b,u)}let p="";throw o||(p=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_06] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat(p))}for(let p=0,u=f.length;p<u;p++){g=typeof f[p]=="function";let d=f[p],O,S,b="",m=l;e==="matchRight"?m+=1:e==="matchLeft"&&(m-=1);let $=ze(r,m,d,i,g,y=>e[5]==="L"?y-1:y+1);if($&&g&&typeof d=="function"&&d()==="EOL")return d()&&(!i.cb||i.cb(O,b,S))?d():!1;if(Number.isInteger($)&&(S=e.startsWith("matchLeft")?$-1:$+1,e[5]==="L"?b=r.slice(0,$):b=r.slice(S)),S<0&&(S=void 0),r[S]&&(O=r[S]),Number.isInteger($)&&(!i.cb||i.cb(O,b,S)))return d}return!1}function we(e,r,l,n){return oe("matchLeft",e,r,l,n)}function le(e,r,l,n){return oe("matchRightIncl",e,r,l,n)}function B(e,r,l,n){return oe("matchRight",e,r,l,n)}var Ke={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function Z(e){var g,a;let r=/^[0-9a-zA-Z]+$/;function l(s){return D(s)&&!s.trim()}if(M(e)){if(!Object.keys(e).length)throw new Error('string-range-expander/expander(): [THROW_ID_02] Input must be a plain object but it\'s been given as a plain object without any keys. However, "from" and "to" settings are obligatory!')}else{let s;throw e===void 0?s="but it is missing completely.":e===null?s="but it was given as null.":s="but it was given as ".concat(typeof e,", equal to:\n").concat(T(e,4),"."),new Error("string-range-expander/expander(): [THROW_ID_01] Input must be a plain object ".concat(s))}if(!V(e.from))throw new Error("string-range-expander/expander(): [THROW_ID_03] The input's \"from\" value resolvedOpts.from, is not a number! It's been given as ".concat(typeof e.from,", equal to ").concat(T(e.from)));if(!V(e.to))throw new Error("string-range-expander/expander(): [THROW_ID_04] The input's \"to\" value resolvedOpts.to, is not a number! It's been given as ".concat(typeof e.to,", equal to ").concat(T(e.to)));if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error('string-range-expander/expander(): [THROW_ID_05] The given input string resolvedOpts.str ("'.concat(e.str,'") must contain the character at index "from" ("').concat(e.from,'")'));if(e!=null&&e.str&&!e.str[e.to-1])throw new Error('string-range-expander/expander(): [THROW_ID_06] The given input string, resolvedOpts.str ("'.concat(e.str,'") must contain the character at index before "to" ("').concat(e.to-1,'")'));if(e.from>e.to)throw new Error('string-range-expander/expander(): [THROW_ID_07] The given "from" index, "'.concat(e.from,'" is greater than "to" index, "').concat(e.to,"\". That's wrong!"));if(e.extendToOneSide===null||D(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!D(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide)throw new Error('string-range-expander/expander(): [THROW_ID_08] The options value "extendToOneSide" is not recognisable! It\'s set to: "'.concat(e.extendToOneSide,'" (').concat(typeof e.extendToOneSide,'). It has to be either Boolean "false" or one of strings: "left" or "right"'));if(e!=null&&e.ifLeftSideIncludesThisThenCropTightly&&!D(e.ifLeftSideIncludesThisThenCropTightly))throw new Error('string-range-expander/expander(): [THROW_ID_09] The option "ifLeftSideIncludesThisThenCropTightly", is not a string! It\'s been given as '.concat(typeof e.ifLeftSideIncludesThisThenCropTightly,", equal to ").concat(T(e.ifLeftSideIncludesThisThenCropTightly)));if(e!=null&&e.ifLeftSideIncludesThisCropItToo&&!D(e.ifLeftSideIncludesThisCropItToo))throw new Error('string-range-expander/expander(): [THROW_ID_10] The option "ifLeftSideIncludesThisCropItToo", is not a string! It\'s been given as '.concat(typeof e.ifLeftSideIncludesThisCropItToo,", equal to ").concat(T(e.ifLeftSideIncludesThisCropItToo)));if(e!=null&&e.ifRightSideIncludesThisThenCropTightly&&!D(e.ifRightSideIncludesThisThenCropTightly))throw new Error('string-range-expander/expander(): [THROW_ID_11] The option "ifRightSideIncludesThisThenCropTightly", is not a string! It\'s been given as '.concat(typeof e.ifRightSideIncludesThisThenCropTightly,", equal to ").concat(T(e.ifRightSideIncludesThisThenCropTightly)));if(e!=null&&e.ifRightSideIncludesThisCropItToo&&!D(e.ifRightSideIncludesThisCropItToo))throw new Error('string-range-expander/expander(): [THROW_ID_12] The option "ifRightSideIncludesThisCropItToo", is not a string! It\'s been given as '.concat(typeof e.ifRightSideIncludesThisCropItToo,", equal to ").concat(T(e.ifRightSideIncludesThisCropItToo)));let n=L(L({},Ke),e),o=n.str,i=n.from,f=n.to;if(n.extendToOneSide!=="right"&&(l(o[i-1])&&(l(o[i-2])||n.ifLeftSideIncludesThisCropItToo.includes(o[i-2]))||o[i-1]&&n.ifLeftSideIncludesThisCropItToo.includes(o[i-1])||n.wipeAllWhitespaceOnLeft&&l(o[i-1]))){for(let s=i;s--;)if(!n.ifLeftSideIncludesThisCropItToo.includes(o[s])){if(o[s].trim()){n.wipeAllWhitespaceOnLeft||n.ifLeftSideIncludesThisCropItToo.includes(o[s+1])?i=s+1:i=s+2;break}else if(s===0){n.wipeAllWhitespaceOnLeft?i=0:i=1;break}}}if(n.extendToOneSide!=="left"&&(l(o[f])&&(n.wipeAllWhitespaceOnRight||l(o[f+1]))||n.ifRightSideIncludesThisCropItToo.includes(o[f]))){for(let s=f,c=o.length;s<c;s++)if(!n.ifRightSideIncludesThisCropItToo.includes(o[s])){if(o[s].trim()){n.wipeAllWhitespaceOnRight||n.ifRightSideIncludesThisCropItToo.includes(o[s-1])?f=s:f=s-1;break}else if(s===o.length-1){n.wipeAllWhitespaceOnRight?f=o.length:f=o.length-1;break}}}return(n.extendToOneSide!=="right"&&D(n.ifLeftSideIncludesThisThenCropTightly)&&n.ifLeftSideIncludesThisThenCropTightly&&(o[i-2]&&n.ifLeftSideIncludesThisThenCropTightly.includes(o[i-2])||o[i-1]&&n.ifLeftSideIncludesThisThenCropTightly.includes(o[i-1]))||n.extendToOneSide!=="left"&&D(n.ifRightSideIncludesThisThenCropTightly)&&n.ifRightSideIncludesThisThenCropTightly&&(o[f+1]&&n.ifRightSideIncludesThisThenCropTightly.includes(o[f+1])||o[f]&&n.ifRightSideIncludesThisThenCropTightly.includes(o[f])))&&(n.extendToOneSide!=="right"&&l(o[i-1])&&!n.wipeAllWhitespaceOnLeft&&(i-=1),n.extendToOneSide!=="left"&&l(o[f])&&!n.wipeAllWhitespaceOnRight&&(f+=1)),n.addSingleSpaceToPreventAccidentalConcatenation&&((g=o[i-1])!=null&&g.trim())&&((a=o[f])!=null&&a.trim())&&(!n.ifLeftSideIncludesThisThenCropTightly&&!n.ifRightSideIncludesThisThenCropTightly||!((!n.ifLeftSideIncludesThisThenCropTightly||n.ifLeftSideIncludesThisThenCropTightly.includes(o[i-1]))&&(!n.ifRightSideIncludesThisThenCropTightly||o[f]&&n.ifRightSideIncludesThisThenCropTightly.includes(o[f]))))&&(r.test(o[i-1])||r.test(o[f]))?[i,f," "]:[i,f]}var De="6.2.1";var Xe=De,Oe={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function Ze(e,r){var ge,fe;let l=Date.now();if(!D(e))throw e===void 0?new Error("html-crush/crush(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error('html-crush/crush(): [THROW_ID_02] the first input argument must be string! It was given as "'.concat(typeof e,'", equal to:\n').concat(T(e,4)));if(r&&!M(r))throw new Error("html-crush/crush(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ".concat(typeof r,", equal to ").concat(T(r,4)));if(r&&Array.isArray(r.breakToTheLeftOf)&&r.breakToTheLeftOf.length){for(let N=0,t=r.breakToTheLeftOf.length;N<t;N++)if(!D(r.breakToTheLeftOf[N]))throw new TypeError("html-crush/crush(): [THROW_ID_04] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ".concat(N,' is of a type "').concat(typeof r.breakToTheLeftOf[N],'" and is equal to:\n').concat(T(r.breakToTheLeftOf[N],4)))}let n=new ye({limitToBeAddedWhitespace:!0}),o=L(L({},Oe),r);typeof o.removeHTMLComments=="boolean"&&(o.removeHTMLComments=o.removeHTMLComments?1:0);let i="";Array.isArray(o.breakToTheLeftOf)&&o.breakToTheLeftOf.length&&(i=[...new Set(o.breakToTheLeftOf.map(N=>N[0]))].join(""));let f={removeHTMLComments:!1,removeCSSComments:!1},g=null,a=null,s=!1,c=0,w=0,E=!1,p=!1,u=null,d=null,O=null,S=null,b,m=null,$=null,y=null,C=null,v=null,x=null,U=">};",j="<",Le="!",Ae=">",Ce="<",se="{},:;<>~+",ee=se,te=se,F=!0,R=e.length,Ie=Math.floor(R/2),ae=.01,ue;o.reportProgressFunc&&(ue=Math.floor(o.reportProgressFuncTo-(o.reportProgressFuncTo-o.reportProgressFuncFrom)*ae-o.reportProgressFuncFrom));let _,G=0,I="\n";if(e.includes("\r\n")?I="\r\n":e.includes("\r")&&(I="\r"),R){for(let t=0;t<R;t++){if(o.reportProgressFunc&&(R>1e3&&R<2e3?t===Ie&&o.reportProgressFunc(Math.floor((o.reportProgressFuncTo-o.reportProgressFuncFrom)/2)):R>=2e3&&(_=o.reportProgressFuncFrom+Math.floor(t/R*(ue||1)),_!==G&&(G=_,o.reportProgressFunc(_)))),w++,!b&&E&&e[t]==="}"&&e[t-1]==="}"&&(c+1>=o.lineLengthLimit?(n.push(t,t,I),c=0):(m=t,$=t,y=" ")),b&&typeof b=="number"&&t>=b&&(b=void 0),S!==null&&e.startsWith("<\/script",t)&&!H(e[t+8])){if((o.removeIndentations||o.removeLineBreaks)&&t>0&&e[~-t]&&!e[~-t].trim()){for(let h=t;h--;)if(e[h]==="\n"||e[h]==="\r"||e[h].trim()){h+1<t&&n.push(h+1,t);break}}S=null,b=!1,t+=8;continue}if(!b&&!E&&e.startsWith("<script",t)&&!H(e[t+7])){S=t,b=!0;let h="";(o.removeLineBreaks||o.removeIndentations)&&a!==null&&(a>0&&(h=I),n.push(a,t,h)),a=null,g=null}if(v!==null&&C===null&&!/\w/.test(e[t])){C=e.slice(v,t);let h=A(e,~-t);typeof h=="number"&&e[h]===">"&&!e[t].trim()&&A(e,t)?n.push(t,A(e,t)):h&&e[h]==="/"&&e[A(e,h)]===">"&&(!e[t].trim()&&A(e,t)&&n.push(t,A(e,t)),e[h+1]!==">"&&A(e,h+1)&&n.push(h+1,A(e,h+1)))}if(!b&&!E&&!u&&e[~-t]==="<"&&v===null&&(/\w/.test(e[t])?v=t:e[A(e,~-t)]==="/"&&/\w/.test(e[A(e,A(e,~-t))]||"")&&(v=A(e,A(e,~-t)))),!b&&(E||u)&&d!==null&&e[t]==="*"&&e[t+1]==="/"&&([m,$]=Z({str:e,from:d,to:t+2,ifLeftSideIncludesThisThenCropTightly:ee||"",ifRightSideIncludesThisThenCropTightly:te||""}),d=null,m!=null?n.push(m,$):(c+=1,t+=1),b=t+2),!b&&(E||u)&&d===null&&e[t]==="/"&&e[t+1]==="*"&&(f.removeCSSComments||(f.removeCSSComments=!0),o.removeCSSComments&&(d=t)),p&&e.startsWith("![endif",t+1)&&(p=!1),!b&&!E&&!u&&O!==null){let h;e.startsWith("-->",t)?h=3:e[t]===">"&&e[t-1]==="]"&&(h=1),h&&([m,$]=Z({str:e,from:O,to:t+h}),O=null,m!=null?o.lineLengthLimit&&w-($-m)>=o.lineLengthLimit?(n.push(m,$,I),w=-h):(n.push(m,$),w-=$-m):(c+=h-1,t+=h-1),b=t+h)}if(!b&&!E&&!u&&(e.startsWith("<!--",t)||o.removeHTMLComments===2&&e.startsWith("<![endif",t))&&O===null&&(e.startsWith("[if",t+4)?(p||(p=!0),o.removeHTMLComments===2&&(O=t)):o.removeHTMLComments&&(!p||o.removeHTMLComments===2)&&(O=t),f.removeHTMLComments||(f.removeHTMLComments=!0)),!b&&E&&d===null&&e.startsWith("</style",t)&&!H(e[t+7])?E=!1:!b&&!E&&d===null&&e.startsWith("<style",t)&&!H(e[t+6])&&(E=!0,(o.removeLineBreaks||o.removeIndentations)&&o.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',t+6)&&e[t+24]&&n.push(t+23,t+23,I)),!b&&!u&&"\"'".includes(e[t])&&e.endsWith("style=",t)&&(u=t),!b&&!e[t].trim())a===null&&(a=t);else if(!b&&!((E||u)&&d!==null)){if(a!==null){if(o.removeLineBreaks&&(c+=1),F)F=!1,(o.removeIndentations||o.removeLineBreaks)&&n.push(0,t);else if(o.removeIndentations&&!o.removeLineBreaks&&(!s&&g!==null&&t>g?n.push(g+1,t):a+1<t&&(e.endsWith("]>",a)||e.endsWith("-->",a)||e.startsWith("<![",t)||e.startsWith("<!--<![",t)?n.push(a,t):e[a]===" "?n.push(a+1,t):e[~-t]===" "?n.push(a,~-t):n.push(a,t," "))),o.removeLineBreaks||u){if(i.includes(e[t])&&le(e,t,o.breakToTheLeftOf)){!("\r\n".includes(e[~-t])&&a===~-t)&&!(e[~-t]==="\n"&&e[t-2]==="\r"&&a===t-2)&&n.push(a,t,I),m=null,$=null,y=null,a=null,c=1;continue}let h=" ";e[t]==="<"&&B(e,t,o.mindTheInlineTags,{cb:q=>!q||!/\w/.test(q)})||(e[~-a]&&Ae.includes(e[~-a])&&Ce.includes(e[t])||(E||u)&&d===null&&(ee.includes(e[~-a])||te.includes(e[t]))||e.startsWith("!important",t)&&!p||u&&(e[~-a]==="'"||e[~-a]==='"')||e[~-a]==="}"&&e.startsWith("</style",t)||e[t]===">"&&("'\"".includes(e[X(e,t)])||e[A(e,t)]==="<")||e[t]==="/"&&e[A(e,t)]===">")&&(h="",e[t]==="/"&&e[t+1]===">"&&A(e,t)&&A(e,t)>t+1&&(n.push(t+1,A(e,t)),c-=A(e,t)-t+1)),E&&e[t]==="}"&&a&&e[a-1]==="}"&&(h=" "),h!=null&&h.length&&(c+=1),o.lineLengthLimit?c>=o.lineLengthLimit||!e[t+1]||e[t]===">"||e[t]==="/"&&e[t+1]===">"?((c>o.lineLengthLimit||c===o.lineLengthLimit&&((ge=e[t+1])!=null&&ge.trim())&&!U.includes(e[t])&&!j.includes(e[t+1]))&&(h=I,c=1),(c>o.lineLengthLimit||!(h===" "&&t===a+1))&&(n.push(a,t,h),g=null),m=null,$=null,y=null):(m===null||a<m)&&(m=a,$=t,y=h):t===a+1&&h===" "||n.push(a,t,h)}a=null,s||(s=!0)}else F&&(F=!1),o.removeLineBreaks&&(c+=1);s||(s=!0)}if(!b&&!F&&t!==0&&o.removeLineBreaks&&(o.lineLengthLimit||i)&&!e.startsWith("</a",t)){if(i&&le(e,t,o.breakToTheLeftOf)&&e.slice(0,t).trim()&&(!e.startsWith("<![endif]",t)||!we(e,t,"<!--"))){n.push(t,t,I),m=null,$=null,y=null,c=1;continue}else if(o.lineLengthLimit&&c<=o.lineLengthLimit){if(!e[t+1]||j.includes(e[t])&&!Le.includes(e[t])||U.includes(e[t])||!e[t].trim()){if(m!==null&&$!==null&&(m!==$||y!=null&&y.length)){let h=y;e[t].trim()&&((fe=e[t+1])!=null&&fe.trim())&&c+(y?y.length:0)>o.lineLengthLimit&&(h=I),(c+(h?h.length:0)>o.lineLengthLimit||!(h===" "&&$===m+1&&e[m]===" "))&&(e[~-m]==="}"&&e[$]==="{"||(n.push(m,$,h),g=null))}e[t].trim()&&(j.includes(e[t])||e[~-t]&&U.includes(e[~-t]))&&D(x)&&(!C||!o.mindTheInlineTags.includes(C))&&!(e[t]==="<"&&B(e,t,o.mindTheInlineTags,{cb:h=>!h||!/\w/.test(h)}))&&!(e[t]==="<"&&B(e,t,o.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:h=>!h||!/\w/.test(h)}))?(m=t,$=t,y=null):d===null&&m!==null&&(u||!o.mindTheInlineTags||!Array.isArray(o.mindTheInlineTags)||Array.isArray(o.mindTheInlineTags.length)&&!o.mindTheInlineTags.length||!D(C)||Array.isArray(o.mindTheInlineTags)&&o.mindTheInlineTags.length&&D(C)&&!o.mindTheInlineTags.includes(C))&&!(e[t]==="<"&&B(e,t,o.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:h=>!h||!/\w/.test(h)}))&&(m=null,$=null,y=null)}}else if(o.lineLengthLimit)if(j.includes(e[t])&&!(e[t]==="<"&&B(e,t,o.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:h=>!h||!/\w/.test(h)})))if(m!==null&&$!==null&&(m!==$||y!=null&&y.length)){let h=y!=null&&y.length?y.length:0;c-($-m-h)-1>o.lineLengthLimit||(n.push(m,$,y),c-($-m-h)-1===o.lineLengthLimit&&(n.push(t,t,I),c=0),m=null,$=null,y=null)}else n.push(t,t,I),c=0;else e[t+1]&&U.includes(e[t])&&D(C)&&Array.isArray(o.mindTheInlineTags)&&o.mindTheInlineTags.length&&!o.mindTheInlineTags.includes(C)?m!==null&&$!==null&&(m!==$||y!=null&&y.length)||(n.push(t+1,t+1,I),c=0):e[t].trim()&&(e[t+1]||m!==null&&$!==null&&(m!==$||y!=null&&y.length)&&n.push(m,$,I))}if(!b&&!F&&o.removeLineBreaks&&o.lineLengthLimit&&c>=o.lineLengthLimit&&m!==null&&$!==null&&!U.includes(e[t])&&!j.includes(e[t])&&!"/".includes(e[t])&&!(c===o.lineLengthLimit&&e[t+1]&&!e[t+1].trim())){let h=I;e[t+1]&&!e[t+1].trim()&&c===o.lineLengthLimit&&(h=y),h===I&&!e[~-m].trim()&&X(e,m)&&(m=X(e,m)+1),n.push(m,$,h),c=t-$,e[t].length&&(c+=1),m=null,$=null,y=null}if((!b&&e[t]==="\n"||e[t]==="\r"&&(!e[t+1]||e[t+1]&&e[t+1]!=="\n"))&&(g=t,s&&(s=!1),!o.removeLineBreaks&&a!==null&&a<t&&e[t+1]&&e[t+1]!=="\r"&&e[t+1]!=="\n"&&n.push(a,t)),e[t+1]||(E&&d!==null?n.push([...Z({str:e,from:d,to:t,ifLeftSideIncludesThisThenCropTightly:ee||"",ifRightSideIncludesThisThenCropTightly:te||""})]):a&&e[t]!=="\n"&&e[t]!=="\r"?n.push(a,t+1):a&&(e[t]==="\r"&&e[t+1]==="\n"||e[t]==="\n"&&e[t-1]!=="\r")&&n.push(a,t)),!b&&u&&u<t&&e[u]===e[t]&&(u=null),!b&&!E&&e.startsWith("<pre",t)&&!H(e[t+4])){let h=e.indexOf("</pre",t+5);h>0&&(b=h)}if(!b&&!E&&e.startsWith("<code",t)&&!H(e[t+5])){let h=e.indexOf("</code",t+5);h>0&&(b=h)}if(!b&&e.startsWith("<![CDATA[",t)){let h=e.indexOf("]]>",t+9);h>0&&(b=h)}if(!b&&!E&&!u&&v!==null&&e[t]===">"&&(e[A(e,t)]==="<"&&(x=C),v=null,C=null),e[t]==="<"&&x!==null&&(x=null),!b&&E&&e[t]==="{"&&e[t+1]==="{"){let h=e.indexOf("}}",t+2);h!==-1&&(b=h+2)}let ne=!0}let N=n.current();if(N){let t=o.reportProgressFuncTo-(o.reportProgressFuncTo-o.reportProgressFuncFrom)*ae,ne=be(e,N,q=>{o.reportProgressFunc&&R>=2e3&&(_=Math.floor(t+(o.reportProgressFuncTo-t)*(q/100)),_!==G&&(G=_,o.reportProgressFunc(_)))}),h=ne.length;return{log:{timeTakenInMilliseconds:Date.now()-l,originalLength:R,cleanedLength:h,bytesSaved:Math.max(R-h,0),percentageReducedOfOriginal:R?Math.round(Math.max(R-h,0)*100/R):0},ranges:N,applicableOpts:f,result:ne}}}return{log:{timeTakenInMilliseconds:Date.now()-l,originalLength:R,cleanedLength:R,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:f,ranges:null,result:e}}return Pe(et);})();
|
|
11
|
+
/**
|
|
12
|
+
* @name codsen-utils
|
|
13
|
+
* @fileoverview Various utility functions
|
|
14
|
+
* @version 1.8.0
|
|
15
|
+
* @author Roy Revelt
|
|
16
|
+
* @license MIT
|
|
17
|
+
* {@link https://codsen.com/os/codsen-utils/}
|
|
18
|
+
*/
|
|
11
19
|
/**
|
|
12
20
|
* @name ranges-sort
|
|
13
21
|
* @fileoverview Sort string index ranges
|
|
14
|
-
* @version 6.
|
|
22
|
+
* @version 6.2.0
|
|
15
23
|
* @author Roy Revelt
|
|
16
24
|
* @license MIT
|
|
17
25
|
* {@link https://codsen.com/os/ranges-sort/}
|
|
@@ -19,7 +27,7 @@
|
|
|
19
27
|
/**
|
|
20
28
|
* @name ranges-merge
|
|
21
29
|
* @fileoverview Merge and sort string index ranges
|
|
22
|
-
* @version 9.1
|
|
30
|
+
* @version 9.2.1
|
|
23
31
|
* @author Roy Revelt
|
|
24
32
|
* @license MIT
|
|
25
33
|
* {@link https://codsen.com/os/ranges-merge/}
|
|
@@ -27,7 +35,7 @@
|
|
|
27
35
|
/**
|
|
28
36
|
* @name ranges-apply
|
|
29
37
|
* @fileoverview Take an array of string index ranges, delete/replace the string according to them
|
|
30
|
-
* @version 7.1
|
|
38
|
+
* @version 7.2.1
|
|
31
39
|
* @author Roy Revelt
|
|
32
40
|
* @license MIT
|
|
33
41
|
* {@link https://codsen.com/os/ranges-apply/}
|
|
@@ -35,31 +43,31 @@
|
|
|
35
43
|
/**
|
|
36
44
|
* @name string-collapse-leading-whitespace
|
|
37
45
|
* @fileoverview Collapse the leading and trailing whitespace of a string
|
|
38
|
-
* @version 7.
|
|
46
|
+
* @version 7.2.0
|
|
39
47
|
* @author Roy Revelt
|
|
40
48
|
* @license MIT
|
|
41
49
|
* {@link https://codsen.com/os/string-collapse-leading-whitespace/}
|
|
42
50
|
*/
|
|
43
51
|
/**
|
|
44
|
-
* @name
|
|
45
|
-
* @fileoverview
|
|
46
|
-
* @version
|
|
52
|
+
* @name ranges-push
|
|
53
|
+
* @fileoverview Gather string index ranges
|
|
54
|
+
* @version 7.2.0
|
|
47
55
|
* @author Roy Revelt
|
|
48
56
|
* @license MIT
|
|
49
|
-
* {@link https://codsen.com/os/
|
|
57
|
+
* {@link https://codsen.com/os/ranges-push/}
|
|
50
58
|
*/
|
|
51
59
|
/**
|
|
52
|
-
* @name
|
|
53
|
-
* @fileoverview
|
|
54
|
-
* @version
|
|
60
|
+
* @name string-left-right
|
|
61
|
+
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
|
|
62
|
+
* @version 6.2.0
|
|
55
63
|
* @author Roy Revelt
|
|
56
64
|
* @license MIT
|
|
57
|
-
* {@link https://codsen.com/os/
|
|
65
|
+
* {@link https://codsen.com/os/string-left-right/}
|
|
58
66
|
*/
|
|
59
67
|
/**
|
|
60
68
|
* @name arrayiffy-if-string
|
|
61
69
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
62
|
-
* @version 5.1
|
|
70
|
+
* @version 5.2.1
|
|
63
71
|
* @author Roy Revelt
|
|
64
72
|
* @license MIT
|
|
65
73
|
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
|
@@ -67,7 +75,7 @@
|
|
|
67
75
|
/**
|
|
68
76
|
* @name string-match-left-right
|
|
69
77
|
* @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
|
|
70
|
-
* @version 9.1
|
|
78
|
+
* @version 9.2.1
|
|
71
79
|
* @author Roy Revelt
|
|
72
80
|
* @license MIT
|
|
73
81
|
* {@link https://codsen.com/os/string-match-left-right/}
|
|
@@ -75,16 +83,8 @@
|
|
|
75
83
|
/**
|
|
76
84
|
* @name string-range-expander
|
|
77
85
|
* @fileoverview Expands string index ranges within whitespace boundaries until letters are met
|
|
78
|
-
* @version 4.
|
|
86
|
+
* @version 4.2.0
|
|
79
87
|
* @author Roy Revelt
|
|
80
88
|
* @license MIT
|
|
81
89
|
* {@link https://codsen.com/os/string-range-expander/}
|
|
82
90
|
*/
|
|
83
|
-
/**
|
|
84
|
-
* @name string-left-right
|
|
85
|
-
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
|
|
86
|
-
* @version 6.1.3
|
|
87
|
-
* @author Roy Revelt
|
|
88
|
-
* @license MIT
|
|
89
|
-
* {@link https://codsen.com/os/string-left-right/}
|
|
90
|
-
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-crush",
|
|
3
|
-
"version": "6.1
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Minify email templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"breaks",
|
|
@@ -44,49 +44,50 @@
|
|
|
44
44
|
},
|
|
45
45
|
"types": "types/index.d.ts",
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "node
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
|
|
47
|
+
"build": "node ../../ops/scripts/esbuild.js && npm run dts",
|
|
48
|
+
"coverage": "c8 uvu test",
|
|
49
|
+
"dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
|
|
51
50
|
"devtest": "c8 npm run unit && npm run examples && npm run lint",
|
|
52
|
-
"dts": "rollup -c &&
|
|
51
|
+
"dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
|
|
53
52
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
54
|
-
"lect": "node '../../ops/lect/lect.js'
|
|
55
|
-
"
|
|
56
|
-
"lint": "
|
|
53
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
54
|
+
"lect:check": "node '../../ops/lect/lect.js' --check",
|
|
55
|
+
"lint": "biome lint --error-on-warnings . && npm run typecheck",
|
|
56
|
+
"lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
|
|
57
57
|
"perf": "node perf/check.js",
|
|
58
58
|
"prep": "echo 'ready'",
|
|
59
|
-
"prettier": "
|
|
60
|
-
"prettier:format": "
|
|
61
|
-
"pretest": "npm run lect && npm run build",
|
|
59
|
+
"prettier": "biome format",
|
|
60
|
+
"prettier:format": "biome format --write .",
|
|
61
|
+
"pretest": "npm run lect:check && npm run build",
|
|
62
62
|
"test": "npm run devtest",
|
|
63
|
+
"typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
|
|
63
64
|
"unit": "uvu test"
|
|
64
65
|
},
|
|
65
|
-
"engines": {
|
|
66
|
-
"node": ">=14.18.0"
|
|
67
|
-
},
|
|
68
66
|
"c8": {
|
|
67
|
+
"all": true,
|
|
69
68
|
"check-coverage": true,
|
|
70
|
-
"exclude": [
|
|
71
|
-
|
|
72
|
-
],
|
|
69
|
+
"exclude": ["**/test/**/*.*"],
|
|
70
|
+
"include": ["dist/*.esm.js"],
|
|
73
71
|
"lines": 100
|
|
74
72
|
},
|
|
75
73
|
"lect": {
|
|
76
74
|
"licence": {
|
|
77
|
-
"extras": [
|
|
78
|
-
""
|
|
79
|
-
]
|
|
75
|
+
"extras": [""]
|
|
80
76
|
}
|
|
81
77
|
},
|
|
82
78
|
"dependencies": {
|
|
83
|
-
"codsen-utils": "^1.
|
|
84
|
-
"ranges-apply": "^7.1
|
|
85
|
-
"ranges-push": "^7.
|
|
86
|
-
"string-left-right": "^6.
|
|
87
|
-
"string-match-left-right": "^9.1
|
|
88
|
-
"string-range-expander": "^4.
|
|
89
|
-
|
|
79
|
+
"codsen-utils": "^1.8.0",
|
|
80
|
+
"ranges-apply": "^7.2.1",
|
|
81
|
+
"ranges-push": "^7.2.0",
|
|
82
|
+
"string-left-right": "^6.2.0",
|
|
83
|
+
"string-match-left-right": "^9.2.1",
|
|
84
|
+
"string-range-expander": "^4.2.0"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"test-mixer": "^4.3.0"
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=18.20.8"
|
|
90
91
|
},
|
|
91
92
|
"publishConfig": {
|
|
92
93
|
"registry": "https://registry.npmjs.org/"
|
package/types/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface Opts {
|
|
|
18
18
|
}
|
|
19
19
|
declare const defaults: Opts;
|
|
20
20
|
interface Res {
|
|
21
|
+
/** Best-effort completion statistics for user-facing feedback.
|
|
22
|
+
* Observational fields do not affect the transformation. */
|
|
21
23
|
log: {
|
|
22
24
|
timeTakenInMilliseconds: number;
|
|
23
25
|
originalLength: number;
|