string-remove-widows 4.2.4 → 4.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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
+ ## 4.2.5 (2026-09-07)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **string-remove-widows:** preserve HTML and template boundaries ([39d94a4](https://github.com/codsen/codsen/commit/39d94a42bd90f92f0e13ec2a62b5375bf6064a9f))
11
+
12
+ ## 4.2.4 (2026-09-06)
13
+
14
+ ### Performance Improvements
15
+
16
+ - Recorded a 8.57% higher normalized benchmark score than v4.2.2 (38,479 → 41,775).
17
+
6
18
  ## 4.2.3 (2026-09-01)
7
19
 
8
20
  ### Bug Fixes
@@ -15,8 +27,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
15
27
 
16
28
  ### Performance Improvements
17
29
 
30
+ - Recorded a 471.92% higher normalized benchmark score than v4.2.1 (6,728 → 38,479).
18
31
  - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
19
32
 
33
+ ## 4.2.1 (2026-08-19)
34
+
35
+ ### Performance Improvements
36
+
37
+ - Recorded a 63.54% higher normalized benchmark score than v4.1.3 (4,114 → 6,728).
38
+
20
39
  ## 4.2.0 (2026-08-19)
21
40
 
22
41
  ### Bug Fixes
@@ -32,10 +51,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
32
51
  - migrate to biome, format all sources, sort the imports, refresh the setup ([693c542](https://github.com/codsen/codsen/commit/693c542058043cf5de77e8d8310f5c8f157c41ca))
33
52
  - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
34
53
 
35
- ### Reverts
54
+ ## 4.1.3 (2026-01-15)
36
55
 
37
- - 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)
38
- - 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)
56
+ ### Performance Improvements
57
+
58
+ - Recorded a 27.96% higher normalized benchmark score than v4.0.36 (3,215 → 4,114).
39
59
 
40
60
  ## 4.0.0 (2022-12-01)
41
61
 
@@ -50,12 +70,66 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
50
70
  - export types ([9d2e8ad](https://github.com/codsen/codsen/commit/9d2e8ad18fbac2478fca6d261a5fa8451f3a85f7))
51
71
  - export types ([11b5fb9](https://github.com/codsen/codsen/commit/11b5fb936ce20e0a77c3a09806773e1cd7695c50))
52
72
 
73
+ ## 3.0.23 (2022-07-26)
74
+
75
+ ### Performance Improvements
76
+
77
+ - Recorded a 7.38% higher normalized benchmark score than v3.0.22 (6,466 → 6,943).
78
+
79
+ ## 3.0.21 (2022-07-13)
80
+
81
+ ### Performance Improvements
82
+
83
+ - Recorded a 22.94% higher normalized benchmark score than v3.0.19 (6,795 → 8,354).
84
+
85
+ ## 3.0.18 (2022-05-04)
86
+
87
+ ### Performance Improvements
88
+
89
+ - Recorded a 149.6% higher normalized benchmark score than v3.0.17 (2,770 → 6,914).
90
+
53
91
  ## 3.0.17 (2022-04-18)
54
92
 
55
93
  ### Fixed
56
94
 
57
95
  - tweak types ([0aee2bd](https://github.com/codsen/codsen/commit/0aee2bdf4ce7fc7357c56b8a281630c4542c9791))
58
96
 
97
+ ## 3.0.15 (2022-04-11)
98
+
99
+ ### Performance Improvements
100
+
101
+ - Recorded a 14.27% higher normalized benchmark score than v3.0.14 (2,915 → 3,331).
102
+
103
+ ## 3.0.13 (2022-03-21)
104
+
105
+ ### Performance Improvements
106
+
107
+ - Recorded a 16.03% higher normalized benchmark score than v3.0.12 (3,088 → 3,583).
108
+
109
+ ## 3.0.12 (2022-01-22)
110
+
111
+ ### Performance Improvements
112
+
113
+ - Recorded a 13.28% higher normalized benchmark score than v3.0.11 (2,726 → 3,088).
114
+
115
+ ## 3.0.10 (2021-12-24)
116
+
117
+ ### Performance Improvements
118
+
119
+ - Recorded a 15.61% higher normalized benchmark score than v3.0.9 (3,402 → 3,933).
120
+
121
+ ## 3.0.9 (2021-12-24)
122
+
123
+ ### Performance Improvements
124
+
125
+ - Recorded a 12.31% higher normalized benchmark score than v3.0.8 (3,029 → 3,402).
126
+
127
+ ## 3.0.7 (2021-11-30)
128
+
129
+ ### Performance Improvements
130
+
131
+ - Recorded a 117.84% higher normalized benchmark score than v3.0.5 (2,489 → 5,422).
132
+
59
133
  ## 3.0.0 (2021-09-09)
60
134
 
61
135
  ### Features
@@ -1,24 +1,25 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 4.2.4
4
+ * @version 4.2.6
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-remove-widows/}
8
8
  */
9
9
 
10
- import{formatDiagnosticValue as F,isLetter as Ue,isPlainObject as Ne,rawMDash as Fe,rawNbsp as Q,rawNDash as Se}from"codsen-utils";import{rApply as Je}from"ranges-apply";import{Ranges as Ke}from"ranges-push";import{left as le,right as Be}from"string-left-right";var ye="4.2.4";var L="&nbsp;",ie="\\0000A0",de="\\u00A0",ve="&ndash;";var Ee="\\u2013",We="&mdash;";var ke="\\u2014",ae=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Pe=[{heads:"{{",tails:"}}"}],ue=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],Te=["abbr","address","area","article","aside","audio","base","bdi","bdo","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","param","picture","pre","progress","rb","rp","rt","rtc","ruby","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","ul","var","video","wbr","xml"];var pn=ye,je=4,Me=5,y={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:je,minCharCount:Me,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},hn=Object.freeze({...y,ignore:Object.freeze([]),tagRanges:Object.freeze([])}),ze=[ve,Ee,We,ke],qe=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function Ge(e,t){let o=0,i=0,r,s,f;for(let m=0;m<e.length;m+=1)if(e[m].trim())i+=1,e[m-1]?.trim()||(o+=1),r!==void 0&&(s=r,f=m,r=void 0);else if(e[m-1]?.trim()&&!(e[m-1]?.toLowerCase()==="r"&&(e[m-2]?.toLowerCase()==="b"||e[m-2]?.toLowerCase()==="h"))){let E=m+1;for(;E<e.length&&!e[E].trim();)E+=1;E<e.length&&(r=m)}let a=!1,p=null,v=e;return s!==void 0&&f!==void 0&&o>=je&&i>=Me&&(a=!0,p=[[s,f,L]],v=`${e.slice(0,s)}${L}${e.slice(f)}`),{res:v,ranges:p,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:a,convertEntities:!1},applicableOpts:{removeWidows:a,convertEntities:a}}}function bn(e,t){let o=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
11
- ${F(e,4)}`);if(t!==void 0&&!Ne(t))throw new Error(`string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof t}, equal to ${F(t,4)}`);if(t===void 0&&!qe.test(e))return Ge(e,o);let i=Array.isArray,r=e.length,s=new Ke({mergeType:2}),f=["."],a=.06,p,v,m=0,E=0,P,c,g,D,C,W,k,S=!1,b,J=0,R,I,j,V,u=sn(e,t),ge={removeWidows:!1,convertEntities:!1},H={removeWidows:!1,convertEntities:!1},X=new Map,K=new Set;function pe(n,l){return`${n}:${l}`}function O(n,l){if(!u.tagRanges.length||n>=l)return!1;let $=0,A=u.tagRanges.length;for(;$<A;){let N=Math.floor(($+A)/2);u.tagRanges[N][1]<=n?$=N+1:A=N}return!!(u.tagRanges[$]&&u.tagRanges[$][0]<l)}function B(n,l){return e.startsWith(n,l)&&!O(l,l+n.length)}let ee=u.reportProgressFuncFrom+Math.floor((u.reportProgressFuncTo-u.reportProgressFuncFrom)*(1-a));function ne(n){if(!u.reportProgressFunc)return;let l=Math.max(u.reportProgressFuncFrom,Math.min(u.reportProgressFuncTo,Math.floor(n)));(v===void 0||l>v)&&(v=l,u.reportProgressFunc(l))}function te(n,l){if(O(n,l))return!1;let $=Q;u.removeWidowPreventionMeasures?$=" ":u.convertEntities&&($=L,u.targetLanguage==="css"?$=ie:u.targetLanguage==="js"&&($=de));let A=pe(n,l),N=_(e,n)===l;return H.removeWidows=!0,N&&(u.removeWidowPreventionMeasures?K.delete(A):K.add(A)),e.slice(n,l)!==$?(s.push(n,l,$),X.set(A,N&&$!==" "?"convertEntities":"removeWidows"),!0):!1}function he(){m=0,E=0,P=void 0,c=void 0,g=void 0,D=void 0,C=void 0,W=void 0,k=void 0,S=!1}he(),ne(u.reportProgressFuncFrom);for(let n=0;n<=r;n++){for(u.reportProgressFunc&&(p=u.reportProgressFuncFrom+Math.floor((r===0?1:Math.min(n,r)/r)*(ee-u.reportProgressFuncFrom)),ne(p));u.tagRanges[J]&&u.tagRanges[J][1]<=n;)J+=1;let l=u.tagRanges[J];if(l&&n>=l[0]&&n<l[1]){let d=R===l[0]||I===l[0]||j!==l[0]&&V!==l[0]&&!e[l[0]-1]?.trim();C!==void 0&&n===l[0]&&e[l[1]]?.trim()&&(P=g,c=D,g=C,D=n),C=void 0,R!==void 0&&R<l[1]&&(R=void 0),j!==void 0&&j<l[1]&&(j=void 0),I!==void 0&&I<l[1]&&(I=void 0),V!==void 0&&V<l[1]&&(V=void 0),e[l[1]]?.trim()&&d&&(I=l[1]),n=l[1]-1;continue}let $=I===n;$&&(I=void 0);let A=V===n;A&&(V=void 0);let N=j===n;N&&(j=void 0),!b&&i(u.ignore)&&u.ignore.length&&u.ignore.some((d,h)=>i(d.heads)&&d.heads.some(Y=>B(Y,n))||typeof d.heads=="string"&&B(d.heads,n)?(C=void 0,m+=1,b=u.ignore[h].tails,!0):!1);let oe=!1;!b&&R!==void 0&&R===n&&(m+=1,k!==void 0&&(S=!0),R=void 0,oe=!0),!b&&n&&e[n]?.trim()&&!e[n-1]?.trim()&&C!==void 0&&(P=g,c=D,g=C,D=n,C=void 0);let re=!b&&(e[n]===Q||e[n]==="&"||e[n]==="\\")?_(e,n):void 0,w=re!==void 0&&!O(n,re)?re:void 0;if(w!==void 0){W=n,k=w,S=!1;let d=pe(n,w);K.add(d);let h=u.convertEntities?u.targetLanguage==="css"?`${ie}${fe(e[w])?" ":""}`:u.targetLanguage==="js"?de:L:Q;e.slice(n,w)!==h&&(s.push(n,w,h),X.set(d,"convertEntities")),e[w]&&!`\r
12
- `.includes(e[w])&&!e[w].trim()&&(j=w),w-n>1&&e[w]?.trim()&&_(e,w)===void 0&&(R=w),n=w-1;continue}!b&&e[n]?.trim()&&(E+=1);let se=!b&&(e[n]==="-"||e[n]===Fe||e[n]===Se||e[n]==="&"||e[n]==="\\")?Ze(e,n):void 0,T=se!==void 0&&!O(n,se)?se:void 0;if(T!==void 0){let d=le(e,n);!oe&&($||!e[n-1]?.trim())&&(m+=1,k!==void 0&&(S=!0));let h=W!==void 0&&k===n&&_(e,W)===n,Y=h&&W!==void 0?W:d===null?n:d+1,Le=d!==null&&!e.slice(d+1,n).split("").some(we=>we==="\r"||we===`
13
- `),$e=T<r&&Le&&!e[T]?.trim()&&(h||!!e[n-1]&&!e[n-1].trim()&&d!==null)&&!O(Y,n);$e&&(H.removeWidows=!0),u.hyphens&&$e&&te(Y,n),e[n]==="\\"&&fe(e[T-1])&&(e[T]&&!`\r
14
- `.includes(e[T])&&!e[T].trim()?j=T:e[T]?.trim()&&(V=T)),n=T-1;continue}if(!b&&!oe&&e[n]?.trim()&&($||!A&&!e[n-1]?.trim())&&(m+=1,k!==void 0&&(S=!0)),!b&&(!e[n]||`\r
10
+ import{formatDiagnosticValue as j,isLetter as sn,isPlainObject as ze,rawMDash as Ge,rawNbsp as de,rawNDash as Ze}from"codsen-utils";import{rApply as dn}from"ranges-apply";import{Ranges as un}from"ranges-push";import{left as $e,right as an}from"string-left-right";var je="4.2.6";function ge(e){return e===32||e>=9&&e<=13&&e!==11}function pe(e,t,r=!0){let i=t+(e[t+1]==="/"?2:1),s=e.charCodeAt(i)|32;if(s<97||s>122)return;for(i+=1;i<e.length;){let o=e.charCodeAt(i);if(o<=62&&(ge(o)||o===47||o===34||o===39||o>=60&&o<=62))break;i+=1}if(e[i]&&!ge(e.charCodeAt(i))&&e[i]!=="/"&&e[i]!==">")return;let d,a=!1,u=!1;for(;i<e.length;i+=1){let o=e[i];if(d)o===d&&(d=void 0);else{if(o===">")return i+1;if(o==="<")return r?i:void 0;ge(e.charCodeAt(i))?u=!1:a?(a=!1,o==='"'||o==="'"?d=o:u=!0):o==="="&&!u&&(a=!0)}}return r?e.length:void 0}var on=new Set(["address","article","aside","blockquote","body","br","caption","center","dd","details","dialog","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"]),rn=new Set(["script","style","pre","code","textarea","title"]);function se(e,t){if(e.startsWith("<!--",t)||e.startsWith("<![CDATA[",t)){let o=e.startsWith("<!--",t)?"-->":"]]>",b=e.indexOf(o,t+4);return{end:b<0?e.length:b+o.length,boundary:!1}}if(e.startsWith("<?",t)){let o=e.indexOf("?>",t+2);return{end:o<0?e.length:o+2,boundary:!1}}if(e.startsWith("<!",t)){let o,b=0;for(let h=t+2;h<e.length;h+=1){let p=e[h];if(o)p===o&&(o=void 0);else if(p==='"'||p==="'")o=p;else if(p==="[")b+=1;else if(p==="]")b=Math.max(0,b-1);else if(p===">"&&!b)return{end:h+1,boundary:!1}}return{end:e.length,boundary:!1}}let r=pe(e,t);if(r===void 0)return;let i=e[t+1]==="/",s=t+(i?2:1),d=s;for(;d<r&&!/[\t\n\f\r />]/.test(e[d]);)d+=1;let a=e.slice(s,d).toLowerCase(),u=on.has(a)||a==="script"||a==="style";if(!i&&rn.has(a)&&e[r-1]===">"){let o=r,b=1;for(;o<e.length&&(o=e.indexOf("<",o),o!==-1);){if((a==="pre"||a==="code")&&(e[o+1]==="!"||e[o+1]==="?")){o=se(e,o).end;continue}let h=e[o+1]==="/",p=o+(h?2:1);if(e.slice(p,p+a.length).toLowerCase()===a&&/[\t\n\f\r />]/.test(e[p+a.length]||"")&&(h||a==="pre"||a==="code")){let W=pe(e,o,!1);if(W!==void 0){if(b+=h?-1:1,!b)return{end:W,boundary:u};o=W;continue}}if(a==="pre"||a==="code"){if(/^<(script|style|textarea|title)(?=[\t\n\f\r />])/i.exec(e.slice(o,o+11))){o=se(e,o).end;continue}let m=pe(e,o);if(m!==void 0){o=m;continue}}o+=1}return{end:e.length,boundary:u}}return{end:r,boundary:u}}function Ie(e,t,r){let i=[],s=t;for(;s<e.length;){let d=e.indexOf("{%",s);if(d<0)break;let a=e.indexOf("%}",d+2);if(a<0)break;let u=/^-?\s*(if|for|endif|endfor)(?=[\s%-]|$)/.exec(e.slice(d+2,a));if(u&&!r(d,a+2)){let o=u[1];if(o==="if"||o==="for")i.push(o);else if(i[i.length-1]===o.slice(3)&&(i.pop(),!i.length))return a+2}s=a+2}}var J="&nbsp;",he="\\0000A0",be="\\u00A0",xe="&ndash;";var He="\\u2013",Ve="&mdash;";var _e="\\u2014",G=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Le=[{heads:"{{",tails:"}}"}],we=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}];var Fn=je,Ye=4,Qe=5,E={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:Ye,minCharCount:Qe,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},Mn=Object.freeze({...E,ignore:Object.freeze([]),tagRanges:Object.freeze([])}),ln=[xe,He,Ve,_e],cn=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function fn(e,t){let r=0,i=0,s,d,a;for(let h=0;h<e.length;h+=1)if(e[h].trim())i+=1,e[h-1]?.trim()||(r+=1),s!==void 0&&(d=s,a=h,s=void 0);else if(e[h-1]?.trim()){let p=h+1;for(;p<e.length&&!e[p].trim();)p+=1;p<e.length&&(s=h)}let u=!1,o=null,b=e;return d!==void 0&&a!==void 0&&r>=Ye&&i>=Qe&&(u=!0,o=[[d,a,J]],b=`${e.slice(0,d)}${J}${e.slice(a)}`),{res:b,ranges:o,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:u,convertEntities:!1},applicableOpts:{removeWidows:u,convertEntities:u}}}function Sn(e,t){let r=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
11
+ ${j(e,4)}`);if(t!==void 0&&!ze(t))throw new Error(`string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof t}, equal to ${j(t,4)}`);if(t===void 0&&!cn.test(e))return fn(e,r);let i=Array.isArray,s=e.length,d=new Map,a=["."],u=.06,o,b,h=0,p=0,W=0,m,y,R,M,k,A,K=[],Q=[],D,S,O,P,w,I=0,Ee=[],x,q,_,z,l=Wn(e,t),ke={removeWidows:!1,convertEntities:!1},V={removeWidows:!1,convertEntities:!1},X=new Map,ee=new Set;function Pe(n,c){return`${n}:${c}`}function Te(n,c,g){if(!n.length||c>=g)return!1;let $=0,F=n.length;for(;$<F;){let L=Math.floor(($+F)/2);n[L][1]<=c?$=L+1:F=L}return!!(n[$]&&n[$][0]<g)}function N(n,c){return Te(l.tagRanges,n,c)||Te(Ee,n,c)}function ne(n,c){return e.startsWith(n,c)&&!N(c,c+n.length)}function Ce(n,c){return(typeof n.heads=="string"?ne(n.heads,c):n.heads.some($=>ne($,c)))&&(!n.nestedBlock||/^\{%-?\s*(if|for)(?=[\s%-]|$)/.test(e.slice(c,c+12)))}let ue=l.reportProgressFuncFrom+Math.floor((l.reportProgressFuncTo-l.reportProgressFuncFrom)*(1-u));function ae(n){if(!l.reportProgressFunc)return;let c=Math.max(l.reportProgressFuncFrom,Math.min(l.reportProgressFuncTo,Math.floor(n)));(b===void 0||c>b)&&(b=c,l.reportProgressFunc(c))}function te(n,c){if(N(n,c))return!1;let g=de;l.removeWidowPreventionMeasures?g=" ":l.convertEntities&&(g=J,l.targetLanguage==="css"?g=he:l.targetLanguage==="js"&&(g=be));let $=Pe(n,c),F=Z(e,n)===c;return V.removeWidows=!0,F&&(l.removeWidowPreventionMeasures?ee.delete($):ee.add($)),e.slice(n,c)!==g?(d.set($,[n,c,g]),X.set($,F&&g!==" "?"convertEntities":"removeWidows"),!0):(d.delete($),X.delete($),!1)}function le(){p=0,W=0,m=void 0,y=void 0,R=void 0,M=void 0,k=void 0,A=void 0,K=[],Q=[],D=void 0,S=void 0,O=void 0,P=void 0}function Re(){let n,c;if(R!==void 0&&M!==void 0&&D!==void 0&&S!==void 0?R>D?(n=R,c=M):(n=D,c=S):R!==void 0&&M!==void 0?(n=R,c=M):D!==void 0&&S!==void 0&&(n=D,c=S),(n===void 0||c===void 0)&&m!==void 0&&y!==void 0&&(n=m,c=y),n!==void 0&&c!==void 0&&(!l.minWordCount||p>=l.minWordCount)&&(!l.minCharCount||W>=l.minCharCount)&&!N(n,c))if(V.removeWidows=!0,n===R&&c===M)for(let[g,$]of Q)te(g,$);else te(n,c);le()}function Ae(n){k!==void 0&&(m=R,y=M,R=k,M=A??n,Q=K,Q.push([R,M]),K=[],k=void 0,A=void 0)}le(),ae(l.reportProgressFuncFrom);for(let n=0;n<=s;n++){for(l.reportProgressFunc&&(o=l.reportProgressFuncFrom+Math.floor((s===0?1:Math.min(n,s)/s)*(ue-l.reportProgressFuncFrom)),ae(o));l.tagRanges[I]&&l.tagRanges[I][1]<=n;)I+=1;let g=l.tagRanges[I],$=!1;if(!w&&e[n]==="<"&&(!g||n<=g[0])&&!l.ignore.some(f=>Ce(f,n))){let f=se(e,n);f&&(g=[n,f.end],$=f.boundary)}if(g&&n>=g[0]&&n<g[1]){for(g=[g[0],g[1]];l.tagRanges[I]&&l.tagRanges[I][0]<g[1];)g[1]=Math.max(g[1],l.tagRanges[I][1]),I+=1;Ee.push(g);let f=x===n||q===n||_!==n&&z!==n&&!e[n-1]?.trim();$?(Re(),h=g[1]):k!==void 0&&A===void 0&&(A=n),x=void 0,_=void 0,q=void 0,z=void 0,($||f)&&(q=g[1]),n=g[1]-1;continue}let F=q===n;F&&(q=void 0);let L=z===n;L&&(z=void 0);let Ne=_===n;if(Ne&&(_=void 0),!w&&i(l.ignore)&&l.ignore.length){let f=!1;if(l.ignore.some((C,ie)=>{if(Ce(C,n)){if(Ae(n),p+=1,P!==void 0&&(D=O,S=P),C.nestedBlock){let U=Ie(e,n,N);return U===void 0?(le(),n=s-1,f=!0,!0):(e[U]?.trim()&&(x=U),n=U-1,f=!0,!0)}return w=l.ignore[ie].tails,!0}return!1}),f)continue}let ce=!1;!w&&x!==void 0&&x===n&&(p+=1,P!==void 0&&(D=O,S=P),x=void 0,ce=!0);let fe=!w&&(e[n]===de||e[n]==="&"||e[n]==="\\")?Z(e,n):void 0,v=fe!==void 0&&!N(n,fe)?fe:void 0;if(!w&&e[n]?.trim()&&v===void 0&&Ae(n),v!==void 0){k=void 0,A=void 0,K=[],O=n,P=v;let f=Pe(n,v);ee.add(f);let C=l.convertEntities?l.targetLanguage==="css"?`${he}${ve(e[v])?" ":""}`:l.targetLanguage==="js"?be:J:de;e.slice(n,v)!==C&&(d.set(f,[n,v,C]),X.set(f,"convertEntities")),e[v]&&!`\r
12
+ `.includes(e[v])&&!e[v].trim()&&(_=v),v-n>1&&e[v]?.trim()&&Z(e,v)===void 0&&(x=v),n=v-1;continue}!w&&e[n]?.trim()&&(W+=1);let me=!w&&(e[n]==="-"||e[n]===Ge||e[n]===Ze||e[n]==="&"||e[n]==="\\")?mn(e,n):void 0,T=me!==void 0&&!N(n,me)?me:void 0;if(T!==void 0){let f=$e(e,n);!ce&&(F||!e[n-1]?.trim())&&(p+=1,P!==void 0&&(D=O,S=P));let C=O!==void 0&&P===n&&Z(e,O)===n,ie=C&&O!==void 0?O:f===null?n:f+1,U=f!==null&&f>=h&&!e.slice(f+1,n).split("").some(Se=>Se==="\r"||Se===`
13
+ `),Me=T<s&&U&&!e[T]?.trim()&&(C||!!e[n-1]&&!e[n-1].trim()&&f!==null)&&!N(ie,n);Me&&(V.removeWidows=!0),l.hyphens&&Me&&te(ie,n),e[n]==="\\"&&ve(e[T-1])&&(e[T]&&!`\r
14
+ `.includes(e[T])&&!e[T].trim()?_=T:e[T]?.trim()&&(z=T)),n=T-1;continue}!w&&!ce&&e[n]?.trim()&&(F||!L&&!e[n-1]?.trim())&&(p+=1,P!==void 0&&(D=O,S=P)),!w&&(!e[n]||`\r
15
15
  `.includes(e[n])||(e[n]===`
16
16
  `||e[n]==="\r"||e[n]==="\r"&&e[n+1]===`
17
- `)&&le(e,n)&&f.includes(e[le(e,n)]))){let d,h;g!==void 0&&D!==void 0&&W!==void 0&&k!==void 0&&S?g>W?(d=g,h=D):(d=W,h=k):g!==void 0&&D!==void 0?(d=g,h=D):W!==void 0&&k!==void 0&&S&&(d=W,h=k),(d===void 0||h===void 0)&&P!==void 0&&c!==void 0&&(d=P,h=c),d!==void 0&&h!==void 0&&(!u.minWordCount||m>=u.minWordCount)&&(!u.minCharCount||E>=u.minCharCount)&&(O(d,h)||(H.removeWidows=!0,te(d,h))),he()}let z=e.charCodeAt(n-1),q=!b&&e[n]&&!e[n].trim()&&!`\r
18
- `.includes(e[n])&&e[n-1]?.trim()&&(z>=48&&z<=57||z>=65&&z<=90)?en(e,n):void 0;q!==void 0&&!O(q.tokenStart,q.tokenEnd)&&(H.removeWidows=!0,u.UKPostcodes&&te(n,q.whitespaceEnd));let G=!b&&e[n]&&!`\r
19
- `.includes(e[n])&&!e[n].trim()&&(N||e[n-1]?.trim())&&C===void 0,Z=G?Be(e,n):null,He=G&&e[n-1]?.toLowerCase()==="r"&&["b","h"].includes(e[n-2]?.toLowerCase()),xe=G&&e[n-1]==="<"&&Z!==null&&Te.some(d=>e.startsWith(d,Z));G&&Z!==null&&!"/>".includes(e[Z])&&!He&&!xe&&(C=n,(W!==void 0||k!==void 0)&&(W=void 0,k=void 0,S=!1));let x;if(b&&(typeof b=="string"&&B(b,n)?x=b:Array.isArray(b)&&b.some(d=>B(d,n)?(x=d,!0):!1),x!==void 0)){let d=n+x.length;if(x.startsWith("{% end")||x.startsWith("{%- end")){for(;d<r&&!e[d].trim();)d+=1;e.startsWith("-%}",d)?d+=3:e.startsWith("%}",d)&&(d+=2)}if(!O(n,d)){b=void 0;let h=_(e,d);e[d]?.trim()&&(h===void 0||O(d,h))&&(R=d),n=d-1}}e[n]&&`\r
20
- `.includes(e[n])&&(m=0,E=0)}let be=s.current(),Ve=Je(e,be,u.reportProgressFunc?n=>{p=ee+Math.floor(n/100*(u.reportProgressFuncTo-ee)),ne(p)}:void 0);for(let n of X.values())ge[n]=!0;return H.convertEntities=H.removeWidows&&!u.removeWidowPreventionMeasures||K.size>0,{res:Ve,ranges:be,log:{timeTakenInMilliseconds:Date.now()-o},whatWasDone:ge,applicableOpts:H}}function Ce(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function fe(e){return e!==void 0&&`
21
- \f\r `.includes(e)}function me(e,t,o,i){if(e[t]!=="\\"||!Ce(e[t+1]))return;let r=t+1;for(;r<e.length&&r-t<=6&&Ce(e[r]);)r+=1;if(Number.parseInt(e.slice(t+1,r),16)===o)return i&&fe(e[r])?e[r]==="\r"&&e[r+1]===`
22
- `?r+2:r+1:r}function _(e,t){let o=e[t];if(o===Q)return t+1;if(o==="&"&&(e.startsWith(L,t)||e.startsWith("&#160;",t)))return t+6;if(o==="\\")return e[t+1]?.toLowerCase()==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&e[t+4]?.toLowerCase()==="a"&&e[t+5]==="0"?t+6:me(e,t,160,!0)}function Ze(e,t){let o=e[t];if(o==="-"||o===Fe||o===Se)return t+1;if(o==="&"||o==="\\"){for(let i of ze)if(e.startsWith(i,t))return t+i.length;if(o==="\\")return me(e,t,8211,!0)??me(e,t,8212,!0)}}function Ae(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122}var ce=[1632,1641,1776,1785,1984,1993,2406,2415,2534,2543,2662,2671,2790,2799,2918,2927,3046,3055,3174,3183,3302,3311,3430,3439,3558,3567,3664,3673,3792,3801,3872,3881,4160,4169,4240,4249,6112,6121,6160,6169,6470,6479,6608,6617,6784,6793,6800,6809,6992,7001,7088,7097,7232,7241,7248,7257,42528,42537,43216,43225,43264,43273,43472,43481,43504,43513,43600,43609,44016,44025,65296,65305,66720,66729,68912,68921,68928,68937,69734,69743,69872,69881,69942,69951,70096,70105,70384,70393,70736,70745,70864,70873,71248,71257,71360,71369,71376,71395,71472,71481,71904,71913,72016,72025,72688,72697,72784,72793,73040,73049,73120,73129,73184,73193,73552,73561,90416,90425,92768,92777,92864,92873,93008,93017,93552,93561,118e3,118009,120782,120831,123200,123209,123632,123641,124144,124153,124401,124410,125264,125273,130032,130041];function Ye(e,t){let o=e.codePointAt(t);return o===void 0?void 0:String.fromCodePoint(o)}function Qe(e,t){if(t<=0)return;let o=e.charCodeAt(t-1);return o>=56320&&o<=57343&&t>1?e.slice(t-2,t):e[t-1]}function Xe(e){if(e===void 0)return!1;let t=e.codePointAt(0),o=0,i=ce.length/2-1;for(;o<=i;){let r=o+i>>1,s=ce[r*2],f=ce[r*2+1];if(t<s)i=r-1;else if(t>f)o=r+1;else return!0}return!1}function De(e){return e!==void 0&&(e==="_"||Ue(e)||Xe(e))}function en(e,t){if(!e[t]||`\r
23
- `.includes(e[t])||e[t].trim()||!e[t-1]?.trim())return;let o=e.charCodeAt(t-1);if(!(o>=48&&o<=57||o>=65&&o<=90))return;let i=t;for(;e[i]&&!e[i].trim()&&!`\r
24
- `.includes(e[i]);)i+=1;if(!e[i])return;let r=e.charCodeAt(i);if(r<48||r>57)return;let s=t-1;for(;s>=0&&Ae(e[s]);)s-=1;s+=1;let f=i;for(;f<e.length&&Ae(e[f]);)f+=1;if(!(De(Qe(e,s))||De(Ye(e,f))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(s,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(i,f))?{whitespaceEnd:i,tokenStart:s,tokenEnd:f}:void 0}var nn=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function U(e){return{heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function M(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Ie(e,t){return Object.getOwnPropertyDescriptor(e,t)?.enumerable===!0}function tn(e){for(let t in e)if(!M(e,t))return t}function Re(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let o=0;o<e.length;o+=1){if(!M(e,o))return;let i=e[o];if(typeof i!="string"||i.length===0)return;t.push(i)}return t}function Oe(e,t){let o=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(o))return`option "ignore" contains an unsupported preset ${JSON.stringify(t)}.`;o==="all"?e.push(...ae.map(U),...ue.map(U)):["nunjucks","jinja","liquid"].includes(o)?e.push(...ae.map(U)):o==="hugo"?e.push(...Pe.map(U)):e.push(...ue.map(U))}function on(e){let t=[];if(typeof e=="string"){let o=Oe(t,e);return o?{ok:!1,kind:"preset",detail:o}:{ok:!0,value:t}}if(!Array.isArray(e))return{ok:!1,kind:"shape",detail:`option "ignore" must be a supported preset or an array of presets and { heads, tails } marker objects, but it was ${F(e,4)}.`};for(let o=0;o<e.length;o+=1){if(!M(e,o))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let i=e[o];if(typeof i=="string"){let p=Oe(t,i);if(p)return{ok:!1,kind:"preset",detail:p};continue}if(!Ne(i)||tn(i)!==void 0||Object.getOwnPropertySymbols(i).some(p=>Ie(i,p)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let r=Object.keys(i);if(r.length!==2||!r.includes("heads")||!r.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let s=i,f=Re(s.heads),a=Re(s.tails);if(f===void 0||a===void 0)return{ok:!1,kind:"shape",detail:"custom ignore marker heads and tails must be non-empty strings or dense arrays of non-empty strings."};t.push({heads:f,tails:a})}return{ok:!0,value:t}}function rn(e,t){if(e===null)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,kind:"container",detail:`option "tagRanges" must be null or an array of half-open ranges, but it was ${F(e,4)}.`};let o=[];for(let r=0;r<e.length;r+=1){if(!M(e,r))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let s=e[r];if(!Array.isArray(s)||s.length!==2&&s.length!==3||!M(s,0)||!M(s,1)||s.length===3&&!M(s,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let f=s[0],a=s[1],p=s.length===3?s[2]:void 0;if(!Number.isInteger(f)||!Number.isInteger(a)||f<0||f>=a||s.length===3&&p!==null&&p!==void 0&&typeof p!="string")return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a non-negative half-open range with integer from/to values and from below to.'};f<t&&o.push([f,Math.min(a,t)])}o.sort((r,s)=>r[0]===s[0]?r[1]-s[1]:r[0]-s[0]);let i=[];for(let r of o){let s=i[i.length-1];s&&r[0]<=s[1]?s[1]=Math.max(s[1],r[1]):i.push(r)}return{ok:!0,value:i}}function sn(e,t){if(t===void 0)return y;let o=t??{},i=Object.keys(o),r;for(let c in o)if(!M(o,c)){r=c;break}let s=i.find(c=>!nn.includes(c)),f=Object.getOwnPropertySymbols(o).find(c=>Ie(o,c));if(s!==void 0||r!==void 0||f!==void 0){let c=s??r??String(f);throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ${JSON.stringify(c)}.`)}let a=Object.create(null);for(let c of i)a[c]=o[c];for(let c of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(c in a&&typeof a[c]!="boolean")throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_05] option ${JSON.stringify(c)} must be Boolean, but it was ${F(a[c],4)}.`);if("targetLanguage"in a&&!["html","css","js"].includes(a.targetLanguage))throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_06] option "targetLanguage" must be exactly "html", "css", or "js", but it was ${F(a.targetLanguage,4)}.`);for(let c of["minWordCount","minCharCount"]){let g=a[c];if(c in a&&g!==!1&&g!==null&&(typeof g!="number"||!Number.isFinite(g)||g<0))throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_07] option ${JSON.stringify(c)} must be a finite non-negative number, false, or null, but it was ${F(g,4)}.`)}let p=on("ignore"in a?a.ignore:y.ignore);if(!p.ok)throw p.kind==="shape"?new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_08] ${p.detail}`):new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_09] ${p.detail}`);let v="reportProgressFunc"in a?a.reportProgressFunc:y.reportProgressFunc;if(v!==!1&&v!==null&&typeof v!="function")throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was ${F(v,4)}.`);for(let c of["reportProgressFuncFrom","reportProgressFuncTo"]){let g=c in a?a[c]:y[c];if(typeof g!="number"||!Number.isInteger(g)||g<0||g>100)throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_11] option ${JSON.stringify(c)} must be an integer from 0 through 100, but it was ${F(g,4)}.`)}let m=a.reportProgressFuncFrom??y.reportProgressFuncFrom,E=a.reportProgressFuncTo??y.reportProgressFuncTo;if(m>E)throw new RangeError(`string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" (${m}) must not exceed "reportProgressFuncTo" (${E}).`);let P=rn("tagRanges"in a?a.tagRanges:[],e.length);if(!P.ok)throw P.kind==="container"?new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_13] ${P.detail}`):new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_14] ${P.detail}`);return{removeWidowPreventionMeasures:a.removeWidowPreventionMeasures??y.removeWidowPreventionMeasures,convertEntities:a.convertEntities??y.convertEntities,targetLanguage:a.targetLanguage??y.targetLanguage,UKPostcodes:a.UKPostcodes??y.UKPostcodes,hyphens:a.hyphens??y.hyphens,minWordCount:"minWordCount"in a?a.minWordCount:y.minWordCount,minCharCount:"minCharCount"in a?a.minCharCount:y.minCharCount,ignore:p.value,reportProgressFunc:typeof v=="function"?v:null,reportProgressFuncFrom:m,reportProgressFuncTo:E,tagRanges:P.value}}export{hn as defaults,bn as removeWidows,pn as version};
17
+ `)&&$e(e,n)&&a.includes(e[$e(e,n)]))&&(Re(),h=n+1);let oe=e.charCodeAt(n-1),re=!w&&e[n]&&!e[n].trim()&&!`\r
18
+ `.includes(e[n])&&e[n-1]?.trim()&&(oe>=48&&oe<=57||oe>=65&&oe<=90)?bn(e,n):void 0;re!==void 0&&!N(re.tokenStart,re.tokenEnd)&&(V.removeWidows=!0,l.UKPostcodes&&te(n,re.whitespaceEnd)),!w&&e[n]&&!e[n].trim()&&!`\r
19
+ `.includes(e[n])&&k!==void 0&&A!==void 0&&(K.push([k,A]),k=n,A=void 0);let Fe=!w&&e[n]&&!`\r
20
+ `.includes(e[n])&&!e[n].trim()&&(Ne||e[n-1]?.trim())&&k===void 0,nn=Fe?an(e,n):null;Fe&&nn!==null&&(k=n,A=void 0);let B;if(w&&(typeof w=="string"&&ne(w,n)?B=w:Array.isArray(w)&&w.some(f=>ne(f,n)?(B=f,!0):!1),B!==void 0)){let f=n+B.length;if(B.startsWith("{% end")||B.startsWith("{%- end")){for(;f<s&&!e[f].trim();)f+=1;e.startsWith("-%}",f)?f+=3:e.startsWith("%}",f)&&(f+=2)}if(!N(n,f)){w=void 0;let C=Z(e,f);e[f]?.trim()&&(C===void 0||N(f,C))&&(x=f),n=f-1}}e[n]&&`\r
21
+ `.includes(e[n])&&(p=0,W=0)}let De=new un({mergeType:2});for(let n of d.values())De.push(n);let Oe=De.current(),en=dn(e,Oe,l.reportProgressFunc?n=>{o=ue+Math.floor(n/100*(l.reportProgressFuncTo-ue)),ae(o)}:void 0);for(let n of X.values())ke[n]=!0;return V.convertEntities=V.removeWidows&&!l.removeWidowPreventionMeasures||ee.size>0,{res:en,ranges:Oe,log:{timeTakenInMilliseconds:Date.now()-r},whatWasDone:ke,applicableOpts:V}}function Be(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function ve(e){return e!==void 0&&`
22
+ \f\r `.includes(e)}function We(e,t,r,i){if(e[t]!=="\\"||!Be(e[t+1]))return;let s=t+1;for(;s<e.length&&s-t<=6&&Be(e[s]);)s+=1;if(Number.parseInt(e.slice(t+1,s),16)===r)return i&&ve(e[s])?e[s]==="\r"&&e[s+1]===`
23
+ `?s+2:s+1:s}function Z(e,t){let r=e[t];if(r===de)return t+1;if(r==="&"&&(e.startsWith(J,t)||e.startsWith("&#160;",t)))return t+6;if(r==="\\")return e[t+1]?.toLowerCase()==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&e[t+4]?.toLowerCase()==="a"&&e[t+5]==="0"?t+6:We(e,t,160,!0)}function mn(e,t){let r=e[t];if(r==="-"||r===Ge||r===Ze)return t+1;if(r==="&"||r==="\\"){for(let i of ln)if(e.startsWith(i,t))return t+i.length;if(r==="\\")return We(e,t,8211,!0)??We(e,t,8212,!0)}}function Ue(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122}var ye=[1632,1641,1776,1785,1984,1993,2406,2415,2534,2543,2662,2671,2790,2799,2918,2927,3046,3055,3174,3183,3302,3311,3430,3439,3558,3567,3664,3673,3792,3801,3872,3881,4160,4169,4240,4249,6112,6121,6160,6169,6470,6479,6608,6617,6784,6793,6800,6809,6992,7001,7088,7097,7232,7241,7248,7257,42528,42537,43216,43225,43264,43273,43472,43481,43504,43513,43600,43609,44016,44025,65296,65305,66720,66729,68912,68921,68928,68937,69734,69743,69872,69881,69942,69951,70096,70105,70384,70393,70736,70745,70864,70873,71248,71257,71360,71369,71376,71395,71472,71481,71904,71913,72016,72025,72688,72697,72784,72793,73040,73049,73120,73129,73184,73193,73552,73561,90416,90425,92768,92777,92864,92873,93008,93017,93552,93561,118e3,118009,120782,120831,123200,123209,123632,123641,124144,124153,124401,124410,125264,125273,130032,130041];function gn(e,t){let r=e.codePointAt(t);return r===void 0?void 0:String.fromCodePoint(r)}function pn(e,t){if(t<=0)return;let r=e.charCodeAt(t-1);return r>=56320&&r<=57343&&t>1?e.slice(t-2,t):e[t-1]}function hn(e){if(e===void 0)return!1;let t=e.codePointAt(0),r=0,i=ye.length/2-1;for(;r<=i;){let s=r+i>>1,d=ye[s*2],a=ye[s*2+1];if(t<d)i=s-1;else if(t>a)r=s+1;else return!0}return!1}function Je(e){return e!==void 0&&(e==="_"||sn(e)||hn(e))}function bn(e,t){if(!e[t]||`\r
24
+ `.includes(e[t])||e[t].trim()||!e[t-1]?.trim())return;let r=e.charCodeAt(t-1);if(!(r>=48&&r<=57||r>=65&&r<=90))return;let i=t;for(;e[i]&&!e[i].trim()&&!`\r
25
+ `.includes(e[i]);)i+=1;if(!e[i])return;let s=e.charCodeAt(i);if(s<48||s>57)return;let d=t-1;for(;d>=0&&Ue(e[d]);)d-=1;d+=1;let a=i;for(;a<e.length&&Ue(e[a]);)a+=1;if(!(Je(pn(e,d))||Je(gn(e,a))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(d,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(i,a))?{whitespaceEnd:i,tokenStart:d,tokenEnd:a}:void 0}var wn=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function Y(e){return{nestedBlock:e===G[1]||e===G[2],heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function H(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Xe(e,t){return Object.getOwnPropertyDescriptor(e,t)?.enumerable===!0}function $n(e){for(let t in e)if(!H(e,t))return t}function Ke(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let r=0;r<e.length;r+=1){if(!H(e,r))return;let i=e[r];if(typeof i!="string"||i.length===0)return;t.push(i)}return t}function qe(e,t){let r=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(r))return`option "ignore" contains an unsupported preset ${JSON.stringify(t)}.`;r==="all"?e.push(...G.map(Y),...we.map(Y)):["nunjucks","jinja","liquid"].includes(r)?e.push(...G.map(Y)):r==="hugo"?e.push(...Le.map(Y)):e.push(...we.map(Y))}function yn(e){let t=[];if(typeof e=="string"){let r=qe(t,e);return r?{ok:!1,kind:"preset",detail:r}:{ok:!0,value:t}}if(!Array.isArray(e))return{ok:!1,kind:"shape",detail:`option "ignore" must be a supported preset or an array of presets and { heads, tails } marker objects, but it was ${j(e,4)}.`};for(let r=0;r<e.length;r+=1){if(!H(e,r))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let i=e[r];if(typeof i=="string"){let o=qe(t,i);if(o)return{ok:!1,kind:"preset",detail:o};continue}if(!ze(i)||$n(i)!==void 0||Object.getOwnPropertySymbols(i).some(o=>Xe(i,o)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let s=Object.keys(i);if(s.length!==2||!s.includes("heads")||!s.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let d=i,a=Ke(d.heads),u=Ke(d.tails);if(a===void 0||u===void 0)return{ok:!1,kind:"shape",detail:"custom ignore marker heads and tails must be non-empty strings or dense arrays of non-empty strings."};t.push({heads:a,tails:u})}return{ok:!0,value:t}}function vn(e,t){if(e===null)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,kind:"container",detail:`option "tagRanges" must be null or an array of half-open ranges, but it was ${j(e,4)}.`};let r=[];for(let s=0;s<e.length;s+=1){if(!H(e,s))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let d=e[s];if(!Array.isArray(d)||d.length!==2&&d.length!==3||!H(d,0)||!H(d,1)||d.length===3&&!H(d,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let a=d[0],u=d[1],o=d.length===3?d[2]:void 0;if(!Number.isInteger(a)||!Number.isInteger(u)||a<0||a>=u||d.length===3&&o!==null&&o!==void 0&&typeof o!="string")return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a non-negative half-open range with integer from/to values and from below to.'};a<t&&r.push([a,Math.min(u,t)])}r.sort((s,d)=>s[0]===d[0]?s[1]-d[1]:s[0]-d[0]);let i=[];for(let s of r){let d=i[i.length-1];d&&s[0]<=d[1]?d[1]=Math.max(d[1],s[1]):i.push(s)}return{ok:!0,value:i}}function Wn(e,t){if(t===void 0)return E;let r=t??{},i=Object.keys(r),s;for(let m in r)if(!H(r,m)){s=m;break}let d=i.find(m=>!wn.includes(m)),a=Object.getOwnPropertySymbols(r).find(m=>Xe(r,m));if(d!==void 0||s!==void 0||a!==void 0){let m=d??s??String(a);throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ${JSON.stringify(m)}.`)}let u=Object.create(null);for(let m of i)u[m]=r[m];for(let m of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(m in u&&typeof u[m]!="boolean")throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_05] option ${JSON.stringify(m)} must be Boolean, but it was ${j(u[m],4)}.`);if("targetLanguage"in u&&!["html","css","js"].includes(u.targetLanguage))throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_06] option "targetLanguage" must be exactly "html", "css", or "js", but it was ${j(u.targetLanguage,4)}.`);for(let m of["minWordCount","minCharCount"]){let y=u[m];if(m in u&&y!==!1&&y!==null&&(typeof y!="number"||!Number.isFinite(y)||y<0))throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_07] option ${JSON.stringify(m)} must be a finite non-negative number, false, or null, but it was ${j(y,4)}.`)}let o=yn("ignore"in u?u.ignore:E.ignore);if(!o.ok)throw o.kind==="shape"?new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_08] ${o.detail}`):new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_09] ${o.detail}`);let b="reportProgressFunc"in u?u.reportProgressFunc:E.reportProgressFunc;if(b!==!1&&b!==null&&typeof b!="function")throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was ${j(b,4)}.`);for(let m of["reportProgressFuncFrom","reportProgressFuncTo"]){let y=m in u?u[m]:E[m];if(typeof y!="number"||!Number.isInteger(y)||y<0||y>100)throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_11] option ${JSON.stringify(m)} must be an integer from 0 through 100, but it was ${j(y,4)}.`)}let h=u.reportProgressFuncFrom??E.reportProgressFuncFrom,p=u.reportProgressFuncTo??E.reportProgressFuncTo;if(h>p)throw new RangeError(`string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" (${h}) must not exceed "reportProgressFuncTo" (${p}).`);let W=vn("tagRanges"in u?u.tagRanges:[],e.length);if(!W.ok)throw W.kind==="container"?new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_13] ${W.detail}`):new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_14] ${W.detail}`);return{removeWidowPreventionMeasures:u.removeWidowPreventionMeasures??E.removeWidowPreventionMeasures,convertEntities:u.convertEntities??E.convertEntities,targetLanguage:u.targetLanguage??E.targetLanguage,UKPostcodes:u.UKPostcodes??E.UKPostcodes,hyphens:u.hyphens??E.hyphens,minWordCount:"minWordCount"in u?u.minWordCount:E.minWordCount,minCharCount:"minCharCount"in u?u.minCharCount:E.minCharCount,ignore:o.value,reportProgressFunc:typeof b=="function"?b:null,reportProgressFuncFrom:h,reportProgressFuncTo:p,tagRanges:W.value}}export{Mn as defaults,Sn as removeWidows,Fn as version};
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 4.2.4
4
+ * @version 4.2.6
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-remove-widows/}
8
8
  */
9
9
 
10
- "use strict";var stringRemoveWidows=(()=>{var ae=Object.defineProperty,Bt=Object.defineProperties,zt=Object.getOwnPropertyDescriptor,Ut=Object.getOwnPropertyDescriptors,qt=Object.getOwnPropertyNames,it=Object.getOwnPropertySymbols;var st=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable;var $e=(e,t,n)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))st.call(t,n)&&$e(e,n,t[n]);if(it)for(var n of it(t))Jt.call(t,n)&&$e(e,n,t[n]);return e},at=(e,t)=>Bt(e,Ut(t));var Kt=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},Gt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qt(t))!st.call(e,i)&&i!==n&&ae(e,i,{get:()=>t[i],enumerable:!(r=zt(t,i))||r.enumerable});return e};var Qt=e=>Gt(ae({},"__esModule",{value:!0}),e);var G=(e,t,n)=>$e(e,typeof t!="symbol"?t+"":t,n);var On={};Kt(On,{defaults:()=>gn,removeWidows:()=>yn,version:()=>cn});function Zt(){let e=[],t=0,n=!1;return{append(r){return n?!1:t+r.length>1999?(e.push("\u2026"),t+=1,n=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return n}}}function Yt(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function le(e,t){if(e.append('"')){for(let n=0;n<t.length&&!e.stopped();n+=1){let r=t.charCodeAt(n);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(Yt(r)):e.append(t[n])}e.append('"')}}function Xt(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function ut(e,t){e.append("Symbol(");let n=String(t);n.length>8&&le(e,n.slice(7,-1)),e.append(")")}function lt(e,t){typeof t=="symbol"?ut(e,t):le(e,String(t))}function g(e,t=0){let n=Zt(),r=t===4?4:0,i=new WeakSet,o=0;function l(_){r&&n.append(" ".repeat(_*r))}function a(_,c){_&&n.append(","),r&&(n.append("\n"),l(c+1))}function u(_,c,w){r&&c&&(n.append("\n"),l(w)),n.append(_)}function f(_,c){Object.prototype.hasOwnProperty.call(_,"value")?y(_.value,c):n.append(Xt(_))}function d(_,c){let w;try{w=Reflect.getOwnPropertyDescriptor(_,"length")}catch(C){n.append("[Uninspectable]");return}let p=w==null?void 0:w.value;if(!Number.isSafeInteger(p)||p<0){n.append("[Uninspectable]");return}n.append("[");let A=!1;for(let C=0;C<p&&!n.stopped();C+=1){if(a(A,c),A=!0,o>=50){n.append("[MaxEntries]");break}o+=1;let W;try{W=Reflect.getOwnPropertyDescriptor(_,String(C))}catch(T){n.append("[Uninspectable]");continue}W!=null&&W.enumerable?f(W,c+1):n.append("[Empty]")}u("]",A,c)}function h(_,c){let w;try{w=Reflect.ownKeys(_)}catch(A){n.append("[Uninspectable]");return}n.append("{");let p=!1;for(let A of w){if(n.stopped())break;if(o>=50){a(p,c),p=!0,le(n,"\u2026"),n.append(r?": ":":"),n.append("[MaxEntries]");break}o+=1;let C;try{C=Reflect.getOwnPropertyDescriptor(_,A)}catch(W){a(p,c),p=!0,lt(n,A),n.append(r?": ":":"),n.append("[Uninspectable]");continue}C!=null&&C.enumerable&&(a(p,c),p=!0,lt(n,A),n.append(r?": ":":"),f(C,c+1))}u("}",p,c)}function m(_,c){if(i.has(_)){n.append("[Circular]");return}if(c>=5){n.append("[MaxDepth]");return}let w;try{w=Array.isArray(_)}catch(p){n.append("[Uninspectable]");return}i.add(_);try{w?d(_,c):h(_,c)}finally{i.delete(_)}}function y(_,c){_===null?n.append("null"):typeof _=="string"?le(n,_):typeof _=="number"?n.append(Object.is(_,-0)?"-0":String(_)):typeof _=="boolean"?n.append(_?"true":"false"):typeof _>"u"?n.append("undefined"):typeof _=="bigint"?n.append("".concat(_,"n")):typeof _=="symbol"?ut(n,_):typeof _=="function"?n.append("[Function]"):m(_,c)}try{return y(e,0),n.result()}catch(_){return"[Uninspectable]"}}var en=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),ve=en.slice(1).split("_"),Ae=[],_t=127;for(let e=0;e<ve.length;e+=2){let t=_t+1+Number.parseInt(ve[e],36),n=t+Number.parseInt(ve[e+1],36);Ae.push([t,n]),_t=n}function tn(e){if(Number.isNaN(e)||e<128||e>1114111)return!1;let t=0,n=Ae.length-1;for(;t<=n;){let r=t+n>>1,i=Ae[r];if(e<i[0])n=r-1;else if(e>i[1])t=r+1;else return!0}return!1}var Te="\u2013",We="\u2014",Q="\xA0";var xn=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"]);var pt=Function.prototype.toString,nn=pt.call(Object);var Pn=Map.prototype.entries,In=Set.prototype.values;var ft,Sn=(ft=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:ft.get,dt,Nn=(dt=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:dt.get,ct,Mn=(ct=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:ct.get,gt,Fn=(gt=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:gt.get,Hn=RegExp.prototype.test;function rn(e){if(e.length===1){let t=e.charCodeAt(0);return t<55296||t>57343?t:-1}if(e.length===2){let t=e.charCodeAt(0),n=e.charCodeAt(1);if(t>=55296&&t<=56319&&n>=56320&&n<=57343)return(t-55296)*1024+n-56320+65536}return-1}function ht(e){if(!N(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>64&&t<91||t>96&&t<123:tn(rn(e))}function x(e){var r;if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.getOwnPropertyDescriptor(t,"constructor");return!n||!("value"in n)||typeof n.value!="function"?!1:((r=Object.getOwnPropertyDescriptor(n.value,"prototype"))==null?void 0:r.value)===t&&pt.call(n.value)===nn}function N(e){return typeof e=="string"}function Ce(e){return Number.isFinite(e)}function Z(e){return Number.isSafeInteger(e)&&e>=0}var Ln=Date.prototype.getTime;function ue(e){return e!=null}var mt={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function on(e,t){let n,r=0;for(;r<e.length;){let i=r+1;for(;i<e.length&&e[r][0]===e[i][0]&&e[r][1]===e[i][1];)i+=1;if(i-r>1){n||(n=new Map(t.map((a,u)=>[a,u])));let o=n,l=e.slice(r,i).sort((a,u)=>o.get(a)-o.get(u));e.splice(r,l.length,...l)}r=i}return e}function q(e,t){var a;if(!Array.isArray(e)||!e.length)return e;let n=t===void 0?!0:x(t);if(t!==void 0&&n&&(t==null?void 0:t.strictlyTwoElementsInRangeArrays)===!0)for(let u=0;u<e.length;u+=1){let f=e[u];if(!Array.isArray(f)||f.length!==2)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, range at index ".concat(u," (").concat(g(f,4),") is ").concat(Array.isArray(f)?"an array with ".concat(f.length," elements"):"not an array","!"));if(!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[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, range at index ".concat(u," (").concat(g(f,4),") does not consist of only natural numbers!"))}else for(let u=0;u<e.length;u+=1){let f=e[u];if(!Array.isArray(f)||!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[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, range at index ".concat(u," (").concat(g(f,4),") does not consist of only natural numbers!"))}if(t!==void 0&&!n)throw new TypeError("ranges-sort/rSort(): [THROW_ID_03] The second argument must be a plain options object; received ".concat(g(t,4)," (type ").concat(typeof t,")!"));let r=mt.progressFn;if(t!==void 0){let u=t.strictlyTwoElementsInRangeArrays;if(u!==void 0&&typeof u!="boolean")throw new TypeError("ranges-sort/rSort(): [THROW_ID_04] opts.strictlyTwoElementsInRangeArrays must be a boolean; received ".concat(g(u,4)," (type ").concat(typeof u,")!"));if(r=(a=t.progressFn)!=null?a:mt.progressFn,r!==!1&&r!==null&&typeof r!="function")throw new TypeError("ranges-sort/rSort(): [THROW_ID_05] opts.progressFn must be a function, false, null, or undefined; received ".concat(g(r,4)," (type ").concat(typeof r,")!"))}let i,o;if(r){let u=e.length**2,f=0,d;o=h=>{h!==d&&(d=h,r(h))},i=Array.from(e).sort((h,m)=>(f+=1,o==null||o(Math.min(99,Math.floor(f*100/u))),h[0]===m[0]?h[1]<m[1]?-1:h[1]>m[1]?1:0:h[0]<m[0]?-1:1))}else i=Array.from(e).sort((u,f)=>u[0]===f[0]?u[1]<f[1]?-1:u[1]>f[1]?1:0:u[0]<f[0]?-1:1);let l=i.length>10?on(i,e):i;return o==null||o(100),l}var sn={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ee(e,t){if(!Array.isArray(e)||!e.length)return null;if(t!==void 0&&!x(t))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(g(t,4)," (type ").concat(typeof t,")"));let n=U(U({},sn),t);if(n.progressFn&&x(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(g(n.progressFn,4)));if(n.mergeType!==1&&n.mergeType!==2&&n.mergeType!=="1"&&n.mergeType!=="2")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(g(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(g(n.joinRangesThatTouchEdges,4)));let r=n.progressFn,i=n.joinRangesThatTouchEdges,o=[];for(let y of e)Array.isArray(y)&&(y[2]!==void 0||y[0]!==y[1])&&o.push([...y]);let l,a,u;r?l=q(o,{progressFn:y=>{u=Math.floor(y/5),u!==a&&(a=u,r(u))}}):l=q(o);let f=l.length-1,d=n.mergeType===2||n.mergeType==="2",h=l.length;for(let y=f;y>=0;y--){let _=l[y];for(r&&y<f&&(u=Math.floor((1-(y+1)/f)*78)+21,u!==a&&u>a&&(a=u,r(u)));h<l.length;){let c=l[h],w=c[0]===_[0];if(!w&&(i?c[0]>_[1]:c[0]>=_[1]))break;let p=c[1]>=_[1];p&&(_[1]=c[1]),c[2]===null?_[2]=null:c[2]!==void 0&&(w||p)&&_[2]!==null&&(_[2]!=null?d&&w?_[2]=c[2]:_[2]+=c[2]:_[2]=c[2]),h+=1}h-=1,l[h]=_}let m=l.length-h;for(let y=0;y<m;y++)l[y]=l[h+y];return l.length=m,r&&a!==99&&r(99),l.length?l:null}function _e(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let t=Number(e);return Number.isInteger(t)&&t>=0}function yt(e,t,n){let r=0,i=0;if(e===void 0&&t===void 0&&n===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(g(e,4)));if(t!=null&&!Array.isArray(t))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof t,", equal to: ").concat(g(t,4)));if(n!=null&&n!==!1&&n!==0&&n!==""&&typeof n!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function, false, null, undefined, 0, or an empty string! Currently it's: ".concat(typeof n,", equal to: ").concat(g(n,4)));if(t==null||!t.length||t.every(d=>d==null))return n&&n(100),e;let o;Array.isArray(t)&&!Array.isArray(t[0])&&_e(t[0])&&_e(t[1])?o=[Array.from(t)]:o=Array.from(t);let l=o.length,a=0;o.forEach((d,h)=>{if(d){if(n&&(r=Math.floor(a/l*10),r!==i&&(i=r,n(r))),!Array.isArray(d))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(h,"th element not an array: ").concat(g(d,4),", which is ").concat(typeof d));if(!_e(d[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its first element is not a non-negative integer or string index, but ").concat(typeof d[0],", equal to: ").concat(g(d[0],4),"."));if(typeof d[0]=="string"&&(o[h]=[...d],o[h][0]=Number(d[0])),!_e(d[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its second element is not a non-negative integer or string index, but ").concat(typeof d[1],", equal to: ").concat(g(d[1],4),"."));if(typeof d[1]=="string"&&(o[h]===d&&(o[h]=[...d]),o[h][1]=Number(d[1])),o[h][0]>o[h][1])throw new RangeError("ranges-apply/rApply(): [THROW_ID_08] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its first index (").concat(o[h][0],") must not be greater than its second index (").concat(o[h][1],")."));a+=1}});let u=n?Ee(o,{progressFn:d=>{r=10+Math.floor(d/10),r!==i&&(i=r,n(r))}}):Ee(o),f=(u==null?void 0:u.length)||0;if(u&&f>0){let d=e.slice(u[f-1][1]);e=u.reduce((h,m,y,_)=>{var p;n&&(r=20+Math.floor(y/f*80),r!==i&&(i=r,n(r)));let c=y===0?0:_[y-1][1],w=_[y][0];return"".concat(h).concat(e.slice(c,w)).concat((p=_[y][2])!=null?p:"")},""),e+=d}return n&&i!==100&&n(100),e}function fe(e,t=1){let n="\xA0";function r(o){return o.length<2?o:Array.from(o).reverse().join("")}function i(o,l,a){let u=a?"\n":"\r",f=a?"\r":"\n";if(!o)return o;let d=0,h="";for(let m=0,y=o.length;m<y;m++)(o[m]===u||o[m]===f&&o[m-1]!==u)&&d++,"\r\n".includes(o[m])||o[m]===n?o[m]===n?h+=o[m]:o[m]===u?d<=l&&(h+=o[m],o[m+1]===f&&(h+=o[m+1],m++)):o[m]===f&&(o==null?void 0:o[m-1])!==u&&d<=l&&(h+=o[m]):!o[m+1]&&!d&&(h+=" ");return h}if(typeof e=="string"&&e.length){let o=e.trim();if(o.length===e.length)return e;let l=1;typeof t=="number"&&Number.isInteger(t)&&t>=0&&(l=t);let a="",u="";if(!o)a=e;else if(!e[0].trim()){for(let d=0,h=e.length;d<h;d++)if(e[d].trim()){a=e.slice(0,d);break}}let f=e[e.length-1];if(o&&(f.trim()===""||f===n)){for(let d=e.length;d--;)if(e[d].trim()){u=e.slice(d+1);break}}return"".concat(i(a,l,!1)).concat(o).concat(r(i(r(u),l,!0)))}return e}var ke={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function bt(e,t,n){return t===void 0||e===null?e:t===null?null:e===void 0||n?t:e+t}function an(e,t){var _,c,w;function n(p){return!!p&&typeof p=="object"&&!Array.isArray(p)}if(!Array.isArray(e)||!e.length)return null;if(t&&!n(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_07] the second input argument must be a plain object. It was given as:\n".concat(g(t,4)," (type ").concat(typeof t,")"));let r=(_=t==null?void 0:t.progressFn)!=null?_:ke.progressFn,i=(c=t==null?void 0:t.mergeType)!=null?c:ke.mergeType,o=(w=t==null?void 0:t.joinRangesThatTouchEdges)!=null?w:ke.joinRangesThatTouchEdges;if(r&&n(r)&&!Object.keys(r).length)r=null;else if(r&&typeof r!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_08] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof r,'", equal to ').concat(g(r,4)));if(i!==1&&i!==2&&i!=="1"&&i!=="2")throw new TypeError('ranges-push/rMerge(): [THROW_ID_09] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof i,'", equal to ').concat(g(i,4)));if(typeof o!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_10] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof o,'", equal to ').concat(g(o,4)));let l=[];for(let p of e)Array.isArray(p)&&(p[2]!==void 0||p[0]!==p[1])&&l.push([...p]);let a,u,f;r?a=q(l,{progressFn:p=>{f=Math.floor(p/5),f!==u&&(u=f,r==null||r(f))}}):a=q(l);let d=a.length-1,h=+i==2,m=a.length;for(let p=d;p>=0;p--){let A=a[p];for(r&&p<d&&(f=Math.floor((1-(p+1)/d)*78)+21,f!==u&&f>u&&(u=f,r(f)));m<a.length;){let C=a[m],W=C[0]===A[0];if(!W&&(o?C[0]>A[1]:C[0]>=A[1]))break;let T=C[1]>=A[1];T&&(A[1]=C[1]),C[2]===null?A[2]=null:C[2]!==void 0&&(W||T)&&(A[2]=bt(A[2],C[2],h&&W)),m+=1}m-=1,a[m]=A}let y=a.length-m;for(let p=0;p<y;p++)a[p]=a[m+p];return a.length=y,a.length?a:null}var de=Object.freeze({limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1});function F(e){if(Z(e))return e;if(typeof e=="string"&&/^\d+$/.test(e)){let t=Number(e);return Z(t)?t:null}return null}function wt(e){if(!Array.isArray(e))return"a ranges batch must contain only range arrays; received ".concat(g(e,4));if(e.length>3)return"a range must contain at most three values; received ".concat(g(e,4));let[t,n,r]=e;if(t==null&&n==null)return;if(t!=null&&n==null)return"the first index is set (".concat(g(t),") but the second index is not (").concat(g(n),")");if(t==null&&n!=null)return"the second index is set (".concat(g(n),") but the first index is not (").concat(g(t),")");let i=F(t),o=F(n);if(i===null)return"the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(t,4)," (type ").concat(typeof t,")");if(o===null)return"the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(n,4)," (type ").concat(typeof n,")");if(ue(r)&&!N(r)&&!Ce(r))return"the third value must be a string, number, null, or undefined; received ".concat(g(r,4)," (type ").concat(typeof r,")");if(i>o)return"the first index (".concat(i,") must not be greater than the second index (").concat(o,")")}function ln(e){if(e.length>3)return{error:"expected at most three arguments but received ".concat(e.length),ranges:[]};if(e.length<=1&&Array.isArray(e[0])){let n=e[0];if(!n.length)return{ranges:[]};e=Array.isArray(n[0])?n:[n]}else e=[e];let t=[];for(let n of e){let r=wt(n);if(r)return{error:r,ranges:[]};let[i,o,l]=n;if(i==null&&o==null)continue;let a=F(i),u=F(o);t.push(l!==void 0&&!(N(l)&&!l.length)?[a,u,l]:[a,u])}return{ranges:t}}function un(e){return e[2]===void 0&&e[0]===e[1]}function _n(e){let t=-1;for(let n=0,r=e.length;n<r;n++){let i=e[n];if(Array.isArray(i)){if(i[0]<t)return!1;t=i[0]}}return!0}var $t=class{constructor(e){G(this,"ranges");G(this,"opts");G(this,"currentCache",null);if(e!=null&&!x(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(g(e,4)," (type ").concat(typeof e,")."));if(e===void 0){this.opts=de,this.ranges=[];return}let t=e,n=t.limitToBeAddedWhitespace===void 0?de.limitToBeAddedWhitespace:t.limitToBeAddedWhitespace,r=t.limitLinebreaksCount===void 0?de.limitLinebreaksCount:t.limitLinebreaksCount,i=t.mergeType===void 0?de.mergeType:t.mergeType,o=i==="1"?1:i==="2"?2:i,l;if(typeof n!="boolean"?l="opts.limitToBeAddedWhitespace must be a boolean; received ".concat(g(n,4)," (type ").concat(typeof n,")"):Z(r)?o!==1&&o!==2&&(l='opts.mergeType must be 1, 2, "1", or "2"; received '.concat(g(i,4)," (type ").concat(typeof i,")")):l="opts.limitLinebreaksCount must be a natural number or zero; received ".concat(g(r,4)," (type ").concat(typeof r,")"),l)throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_02] ".concat(l,"."));let a=Object.freeze({limitToBeAddedWhitespace:n,limitLinebreaksCount:r,mergeType:o});this.opts=a,this.ranges=[]}rangeListsMatch(e,t){if(!Array.isArray(e))return t===null;if(!Array.isArray(t)||e.length!==t[0])return!1;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!Array.isArray(o)){if(t[n++]!==-1||o!==t[n++])return!1;continue}if(o.length!==t[n++])return!1;for(let l=0;l<o.length;l++)if(o[l]!==t[n++])return!1}return n===t.length}snapshotRanges(e){if(!Array.isArray(e))return null;let t=new Array(1+e.length*4);t[0]=e.length;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(Array.isArray(o)){t[n++]=o.length;for(let l=0;l<o.length;l++)t[n++]=o[l]}else t[n++]=-1,t[n++]=o}return t.length=n,t}currentStateMatchesSnapshot(){let e=this.currentCache;return e!==null&&this.rangeListsMatch(this.ranges,e.rangesSnapshot)&&this.rangeListsMatch(e.result,e.resultSnapshot)}recordCurrentSnapshot(e){let t=this.snapshotRanges(this.ranges);this.currentCache={rangesSnapshot:t,result:e,resultSnapshot:e===this.ranges?t:this.snapshotRanges(e)}}invalidateCurrentCache(){this.currentCache=null}addValidated(e,t,n){this.invalidateCurrentCache();let r=this.last();if(ue(this.ranges)&&Array.isArray(r)&&e===r[1]){if(r[1]=t,n!==void 0&&!(N(n)&&!n.length)){let o=bt(r[2],n,this.opts.mergeType===2&&r[0]===e);this.opts.limitToBeAddedWhitespace&&typeof o=="string"&&(o=fe(o,this.opts.limitLinebreaksCount)),N(o)&&!o.length||(r[2]=o)}return}this.ranges||(this.ranges=[]);let i=n!==void 0?[e,t,typeof n=="string"&&this.opts.limitToBeAddedWhitespace?fe(n,this.opts.limitLinebreaksCount):n]:[e,t];this.ranges.push(i)}add(e,t,n){let r=arguments.length,i;if(r>3)i="expected at most three arguments but received ".concat(r);else if(r===1&&Array.isArray(e)){let o=Array.isArray(e[0])?e:[e];for(let l=0,a=o.length;l<a&&(i=wt(o[l]),!i);l++);if(!i)for(let l=0,a=o.length;l<a;l++){let[u,f,d]=o[l];u==null&&f==null||this.addValidated(F(u),F(f),N(d)&&!d.length?void 0:d)}}else{if(e==null&&t==null)return;if(e!=null&&t==null)i="the first index is set (".concat(g(e),") but the second index is not (").concat(g(t),")");else if(e==null&&t!=null)i="the second index is set (".concat(g(t),") but the first index is not (").concat(g(e),")");else{let o=F(e),l=F(t);o===null?i="the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(e,4)," (type ").concat(typeof e,")"):l===null?i="the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(t,4)," (type ").concat(typeof t,")"):ue(n)&&!N(n)&&!Ce(n)?i="the third value must be a string, number, null, or undefined; received ".concat(g(n,4)," (type ").concat(typeof n,")"):o>l?i="the first index (".concat(o,") must not be greater than the second index (").concat(l,")"):this.addValidated(o,l,N(n)&&!n.length?void 0:n)}}if(i)throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_03] ".concat(i,"."))}push(e,t,n){this.add.apply(this,arguments)}current(){var e,t;if(this.currentStateMatchesSnapshot())return(t=(e=this.currentCache)==null?void 0:e.result)!=null?t:null;if(Array.isArray(this.ranges)&&this.ranges.length){this.ranges=an(this.ranges,this.opts.mergeType===1?void 0:{mergeType:2});let n=this.ranges;return n&&this.opts.limitToBeAddedWhitespace&&(n=n.map(r=>typeof r[2]=="string"?[r[0],r[1],fe(r[2],this.opts.limitLinebreaksCount)]:r)),this.recordCurrentSnapshot(n),n}return this.recordCurrentSnapshot(null),null}firstCovers(e){if(!Z(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_04] the input argument must be a natural number or zero! It was given as ".concat(g(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=_n(this.ranges)?this.ranges:this.ranges.filter(r=>Array.isArray(r)).slice().sort((r,i)=>r[0]-i[0]||r[1]-i[1]),n=null;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!(!Array.isArray(o)||un(o))){if(n===null){if(o[0]!==0)return!1;n=o[1]}else{if(o[0]>n)break;o[1]>n&&(n=o[1])}if(n>=e)return!0}}return n!==null&&n>=e}wipe(){this.ranges=[],this.invalidateCurrentCache()}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])){let t=ln([e]);if(t.error)throw new TypeError("ranges-push/Ranges/replace(): [THROW_ID_06] ".concat(t.error,"."));this.ranges=t.ranges,this.invalidateCurrentCache()}else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_05] Single range was given but we expected array of arrays! The first element, ".concat(g(e[0],4)," should be an array."));else this.ranges=[],this.invalidateCurrentCache()}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};function J(e){return e===32||e>=9&&e<=13||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function vt(e,t){return t==null?0:typeof t!="number"||!Number.isInteger(t)||t<0?null:t>e?e:t}function fn(e,t){return t===-1?-1:vt(e,t)}function At(e,t=0){if(typeof e!="string"||!e.length)return null;let n=fn(e.length,t);if(n===null||n+1>=e.length)return null;let r=n+1;if(!J(e.charCodeAt(r)))return r;if(r+=1,r>=e.length)return null;if(!J(e.charCodeAt(r)))return r;for(r+=1;r<e.length;r++)if(!J(e.charCodeAt(r)))return r;return null}function ce(e,t=0){if(typeof e!="string"||!e.length)return null;let n=vt(e.length,t);if(n===null||n<1)return null;let r=n-1;if(!J(e.charCodeAt(r)))return r;if(r-=1,r<0)return null;if(!J(e.charCodeAt(r)))return r;for(r-=1;r>=0;r--)if(!J(e.charCodeAt(r)))return r;return null}var Tt="4.2.4";var K="&nbsp;",Oe="\\0000A0",Re="\\u00A0",Wt="&ndash;";var Ct="\\u2013",Et="&mdash;";var kt="\\u2014",De=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Ot=[{heads:"{{",tails:"}}"}],je=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],Rt=["abbr","address","area","article","aside","audio","base","bdi","bdo","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","param","picture","pre","progress","rb","rp","rt","rtc","ruby","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","ul","var","video","wbr","xml"];var cn=Tt,St=4,Nt=5,D={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:St,minCharCount:Nt,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},gn=Object.freeze(at(U({},D),{ignore:Object.freeze([]),tagRanges:Object.freeze([])})),pn=[Wt,Ct,Et,kt],hn=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function mn(e,t){var d,h,m,y,_;let n=0,r=0,i,o,l;for(let c=0;c<e.length;c+=1)if(e[c].trim())r+=1,(d=e[c-1])!=null&&d.trim()||(n+=1),i!==void 0&&(o=i,l=c,i=void 0);else if((h=e[c-1])!=null&&h.trim()&&!(((m=e[c-1])==null?void 0:m.toLowerCase())==="r"&&(((y=e[c-2])==null?void 0:y.toLowerCase())==="b"||((_=e[c-2])==null?void 0:_.toLowerCase())==="h"))){let w=c+1;for(;w<e.length&&!e[w].trim();)w+=1;w<e.length&&(i=c)}let a=!1,u=null,f=e;return o!==void 0&&l!==void 0&&n>=St&&r>=Nt&&(a=!0,u=[[o,l,K]],f="".concat(e.slice(0,o)).concat(K).concat(e.slice(l))),{res:f,ranges:u,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:a,convertEntities:!1},applicableOpts:{removeWidows:a,convertEntities:a}}}function yn(e,t){var He,Le,Ve,Be,ze,Ue,qe,Je,Ke,Ge,Qe,Ze,Ye,Xe,et,tt,nt;let n=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error('string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "'.concat(typeof e,'", equal to:\n').concat(g(e,4)));if(t!==void 0&&!x(t))throw new Error("string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ".concat(typeof t,", equal to ").concat(g(t,4)));if(t===void 0&&!hn.test(e))return mn(e,n);let r=Array.isArray,i=e.length,o=new $t({mergeType:2}),l=["."],a=.06,u,f,d=0,h=0,m,y,_,c,w,p,A,C=!1,W,T=0,E,L,M,V,$=kn(e,t),Se={removeWidows:!1,convertEntities:!1},B={removeWidows:!1,convertEntities:!1},ge=new Map,ee=new Set;function Ne(s,v){return"".concat(s,":").concat(v)}function I(s,v){if(!$.tagRanges.length||s>=v)return!1;let O=0,P=$.tagRanges.length;for(;O<P;){let S=Math.floor((O+P)/2);$.tagRanges[S][1]<=s?O=S+1:P=S}return!!($.tagRanges[O]&&$.tagRanges[O][0]<v)}function te(s,v){return e.startsWith(s,v)&&!I(v,v+s.length)}let pe=$.reportProgressFuncFrom+Math.floor(($.reportProgressFuncTo-$.reportProgressFuncFrom)*(1-a));function he(s){if(!$.reportProgressFunc)return;let v=Math.max($.reportProgressFuncFrom,Math.min($.reportProgressFuncTo,Math.floor(s)));(f===void 0||v>f)&&(f=v,$.reportProgressFunc(v))}function me(s,v){if(I(s,v))return!1;let O=Q;$.removeWidowPreventionMeasures?O=" ":$.convertEntities&&(O=K,$.targetLanguage==="css"?O=Oe:$.targetLanguage==="js"&&(O=Re));let P=Ne(s,v),S=Y(e,s)===v;return B.removeWidows=!0,S&&($.removeWidowPreventionMeasures?ee.delete(P):ee.add(P)),e.slice(s,v)!==O?(o.push(s,v,O),ge.set(P,S&&O!==" "?"convertEntities":"removeWidows"),!0):!1}function Me(){d=0,h=0,m=void 0,y=void 0,_=void 0,c=void 0,w=void 0,p=void 0,A=void 0,C=!1}Me(),he($.reportProgressFuncFrom);for(let s=0;s<=i;s++){for($.reportProgressFunc&&(u=$.reportProgressFuncFrom+Math.floor((i===0?1:Math.min(s,i)/i)*(pe-$.reportProgressFuncFrom)),he(u));$.tagRanges[T]&&$.tagRanges[T][1]<=s;)T+=1;let v=$.tagRanges[T];if(v&&s>=v[0]&&s<v[1]){let b=E===v[0]||L===v[0]||M!==v[0]&&V!==v[0]&&!((He=e[v[0]-1])!=null&&He.trim());w!==void 0&&s===v[0]&&((Le=e[v[1]])!=null&&Le.trim())&&(m=_,y=c,_=w,c=s),w=void 0,E!==void 0&&E<v[1]&&(E=void 0),M!==void 0&&M<v[1]&&(M=void 0),L!==void 0&&L<v[1]&&(L=void 0),V!==void 0&&V<v[1]&&(V=void 0),(Ve=e[v[1]])!=null&&Ve.trim()&&b&&(L=v[1]),s=v[1]-1;continue}let O=L===s;O&&(L=void 0);let P=V===s;P&&(V=void 0);let S=M===s;S&&(M=void 0),!W&&r($.ignore)&&$.ignore.length&&$.ignore.some((b,k)=>r(b.heads)&&b.heads.some(se=>te(se,s))||typeof b.heads=="string"&&te(b.heads,s)?(w=void 0,d+=1,W=$.ignore[k].tails,!0):!1);let ye=!1;!W&&E!==void 0&&E===s&&(d+=1,A!==void 0&&(C=!0),E=void 0,ye=!0),!W&&s&&((Be=e[s])!=null&&Be.trim())&&!((ze=e[s-1])!=null&&ze.trim())&&w!==void 0&&(m=_,y=c,_=w,c=s,w=void 0);let be=!W&&(e[s]===Q||e[s]==="&"||e[s]==="\\")?Y(e,s):void 0,R=be!==void 0&&!I(s,be)?be:void 0;if(R!==void 0){p=s,A=R,C=!1;let b=Ne(s,R);ee.add(b);let k=$.convertEntities?$.targetLanguage==="css"?"".concat(Oe).concat(Pe(e[R])?" ":""):$.targetLanguage==="js"?Re:K:Q;e.slice(s,R)!==k&&(o.push(s,R,k),ge.set(b,"convertEntities")),e[R]&&!"\r\n".includes(e[R])&&!e[R].trim()&&(M=R),R-s>1&&((Ue=e[R])!=null&&Ue.trim())&&Y(e,R)===void 0&&(E=R),s=R-1;continue}!W&&((qe=e[s])!=null&&qe.trim())&&(h+=1);let we=!W&&(e[s]==="-"||e[s]===We||e[s]===Te||e[s]==="&"||e[s]==="\\")?bn(e,s):void 0,j=we!==void 0&&!I(s,we)?we:void 0;if(j!==void 0){let b=ce(e,s);!ye&&(O||!((Je=e[s-1])!=null&&Je.trim()))&&(d+=1,A!==void 0&&(C=!0));let k=p!==void 0&&A===s&&Y(e,p)===s,se=k&&p!==void 0?p:b===null?s:b+1,Vt=b!==null&&!e.slice(b+1,s).split("").some(ot=>ot==="\r"||ot==="\n"),rt=j<i&&Vt&&!((Ke=e[j])!=null&&Ke.trim())&&(k||!!e[s-1]&&!e[s-1].trim()&&b!==null)&&!I(se,s);rt&&(B.removeWidows=!0),$.hyphens&&rt&&me(se,s),e[s]==="\\"&&Pe(e[j-1])&&(e[j]&&!"\r\n".includes(e[j])&&!e[j].trim()?M=j:(Ge=e[j])!=null&&Ge.trim()&&(V=j)),s=j-1;continue}if(!W&&!ye&&((Qe=e[s])!=null&&Qe.trim())&&(O||!P&&!((Ze=e[s-1])!=null&&Ze.trim()))&&(d+=1,A!==void 0&&(C=!0)),!W&&(!e[s]||"\r\n".includes(e[s])||(e[s]==="\n"||e[s]==="\r"||e[s]==="\r"&&e[s+1]==="\n")&&ce(e,s)&&l.includes(e[ce(e,s)]))){let b,k;_!==void 0&&c!==void 0&&p!==void 0&&A!==void 0&&C?_>p?(b=_,k=c):(b=p,k=A):_!==void 0&&c!==void 0?(b=_,k=c):p!==void 0&&A!==void 0&&C&&(b=p,k=A),(b===void 0||k===void 0)&&m!==void 0&&y!==void 0&&(b=m,k=y),b!==void 0&&k!==void 0&&(!$.minWordCount||d>=$.minWordCount)&&(!$.minCharCount||h>=$.minCharCount)&&(I(b,k)||(B.removeWidows=!0,me(b,k))),Me()}let ne=e.charCodeAt(s-1),re=!W&&e[s]&&!e[s].trim()&&!"\r\n".includes(e[s])&&((Ye=e[s-1])!=null&&Ye.trim())&&(ne>=48&&ne<=57||ne>=65&&ne<=90)?An(e,s):void 0;re!==void 0&&!I(re.tokenStart,re.tokenEnd)&&(B.removeWidows=!0,$.UKPostcodes&&me(s,re.whitespaceEnd));let oe=!W&&e[s]&&!"\r\n".includes(e[s])&&!e[s].trim()&&(S||((Xe=e[s-1])==null?void 0:Xe.trim()))&&w===void 0,ie=oe?At(e,s):null,Ht=oe&&((et=e[s-1])==null?void 0:et.toLowerCase())==="r"&&["b","h"].includes((tt=e[s-2])==null?void 0:tt.toLowerCase()),Lt=oe&&e[s-1]==="<"&&ie!==null&&Rt.some(b=>e.startsWith(b,ie));oe&&ie!==null&&!"/>".includes(e[ie])&&!Ht&&!Lt&&(w=s,(p!==void 0||A!==void 0)&&(p=void 0,A=void 0,C=!1));let z;if(W&&(typeof W=="string"&&te(W,s)?z=W:Array.isArray(W)&&W.some(b=>te(b,s)?(z=b,!0):!1),z!==void 0)){let b=s+z.length;if(z.startsWith("{% end")||z.startsWith("{%- end")){for(;b<i&&!e[b].trim();)b+=1;e.startsWith("-%}",b)?b+=3:e.startsWith("%}",b)&&(b+=2)}if(!I(s,b)){W=void 0;let k=Y(e,b);(nt=e[b])!=null&&nt.trim()&&(k===void 0||I(b,k))&&(E=b),s=b-1}}e[s]&&"\r\n".includes(e[s])&&(d=0,h=0)}let Fe=o.current(),Ft=yt(e,Fe,$.reportProgressFunc?s=>{u=pe+Math.floor(s/100*($.reportProgressFuncTo-pe)),he(u)}:void 0);for(let s of ge.values())Se[s]=!0;return B.convertEntities=B.removeWidows&&!$.removeWidowPreventionMeasures||ee.size>0,{res:Ft,ranges:Fe,log:{timeTakenInMilliseconds:Date.now()-n},whatWasDone:Se,applicableOpts:B}}function Dt(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function Pe(e){return e!==void 0&&" \n\f\r ".includes(e)}function Ie(e,t,n,r){if(e[t]!=="\\"||!Dt(e[t+1]))return;let i=t+1;for(;i<e.length&&i-t<=6&&Dt(e[i]);)i+=1;if(Number.parseInt(e.slice(t+1,i),16)===n)return r&&Pe(e[i])?e[i]==="\r"&&e[i+1]==="\n"?i+2:i+1:i}function Y(e,t){var r,i;let n=e[t];if(n===Q)return t+1;if(n==="&"&&(e.startsWith(K,t)||e.startsWith("&#160;",t)))return t+6;if(n==="\\")return((r=e[t+1])==null?void 0:r.toLowerCase())==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&((i=e[t+4])==null?void 0:i.toLowerCase())==="a"&&e[t+5]==="0"?t+6:Ie(e,t,160,!0)}function bn(e,t){var r;let n=e[t];if(n==="-"||n===We||n===Te)return t+1;if(n==="&"||n==="\\"){for(let i of pn)if(e.startsWith(i,t))return t+i.length;if(n==="\\")return(r=Ie(e,t,8211,!0))!=null?r:Ie(e,t,8212,!0)}}function jt(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122}var xe=[1632,1641,1776,1785,1984,1993,2406,2415,2534,2543,2662,2671,2790,2799,2918,2927,3046,3055,3174,3183,3302,3311,3430,3439,3558,3567,3664,3673,3792,3801,3872,3881,4160,4169,4240,4249,6112,6121,6160,6169,6470,6479,6608,6617,6784,6793,6800,6809,6992,7001,7088,7097,7232,7241,7248,7257,42528,42537,43216,43225,43264,43273,43472,43481,43504,43513,43600,43609,44016,44025,65296,65305,66720,66729,68912,68921,68928,68937,69734,69743,69872,69881,69942,69951,70096,70105,70384,70393,70736,70745,70864,70873,71248,71257,71360,71369,71376,71395,71472,71481,71904,71913,72016,72025,72688,72697,72784,72793,73040,73049,73120,73129,73184,73193,73552,73561,90416,90425,92768,92777,92864,92873,93008,93017,93552,93561,118e3,118009,120782,120831,123200,123209,123632,123641,124144,124153,124401,124410,125264,125273,130032,130041];function wn(e,t){let n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function $n(e,t){if(t<=0)return;let n=e.charCodeAt(t-1);return n>=56320&&n<=57343&&t>1?e.slice(t-2,t):e[t-1]}function vn(e){if(e===void 0)return!1;let t=e.codePointAt(0),n=0,r=xe.length/2-1;for(;n<=r;){let i=n+r>>1,o=xe[i*2],l=xe[i*2+1];if(t<o)r=i-1;else if(t>l)n=i+1;else return!0}return!1}function xt(e){return e!==void 0&&(e==="_"||ht(e)||vn(e))}function An(e,t){var a;if(!e[t]||"\r\n".includes(e[t])||e[t].trim()||!((a=e[t-1])!=null&&a.trim()))return;let n=e.charCodeAt(t-1);if(!(n>=48&&n<=57||n>=65&&n<=90))return;let r=t;for(;e[r]&&!e[r].trim()&&!"\r\n".includes(e[r]);)r+=1;if(!e[r])return;let i=e.charCodeAt(r);if(i<48||i>57)return;let o=t-1;for(;o>=0&&jt(e[o]);)o-=1;o+=1;let l=r;for(;l<e.length&&jt(e[l]);)l+=1;if(!(xt($n(e,o))||xt(wn(e,l))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(o,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(r,l))?{whitespaceEnd:r,tokenStart:o,tokenEnd:l}:void 0}var Tn=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function X(e){return{heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function H(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Mt(e,t){var n;return((n=Object.getOwnPropertyDescriptor(e,t))==null?void 0:n.enumerable)===!0}function Wn(e){for(let t in e)if(!H(e,t))return t}function Pt(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let n=0;n<e.length;n+=1){if(!H(e,n))return;let r=e[n];if(typeof r!="string"||r.length===0)return;t.push(r)}return t}function It(e,t){let n=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(n))return'option "ignore" contains an unsupported preset '.concat(JSON.stringify(t),".");n==="all"?e.push(...De.map(X),...je.map(X)):["nunjucks","jinja","liquid"].includes(n)?e.push(...De.map(X)):n==="hugo"?e.push(...Ot.map(X)):e.push(...je.map(X))}function Cn(e){let t=[];if(typeof e=="string"){let n=It(t,e);return n?{ok:!1,kind:"preset",detail:n}:{ok:!0,value:t}}if(!Array.isArray(e))return{ok:!1,kind:"shape",detail:'option "ignore" must be a supported preset or an array of presets and { heads, tails } marker objects, but it was '.concat(g(e,4),".")};for(let n=0;n<e.length;n+=1){if(!H(e,n))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let r=e[n];if(typeof r=="string"){let u=It(t,r);if(u)return{ok:!1,kind:"preset",detail:u};continue}if(!x(r)||Wn(r)!==void 0||Object.getOwnPropertySymbols(r).some(u=>Mt(r,u)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let i=Object.keys(r);if(i.length!==2||!i.includes("heads")||!i.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let o=r,l=Pt(o.heads),a=Pt(o.tails);if(l===void 0||a===void 0)return{ok:!1,kind:"shape",detail:"custom ignore marker heads and tails must be non-empty strings or dense arrays of non-empty strings."};t.push({heads:l,tails:a})}return{ok:!0,value:t}}function En(e,t){if(e===null)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,kind:"container",detail:'option "tagRanges" must be null or an array of half-open ranges, but it was '.concat(g(e,4),".")};let n=[];for(let i=0;i<e.length;i+=1){if(!H(e,i))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let o=e[i];if(!Array.isArray(o)||o.length!==2&&o.length!==3||!H(o,0)||!H(o,1)||o.length===3&&!H(o,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let l=o[0],a=o[1],u=o.length===3?o[2]:void 0;if(!Number.isInteger(l)||!Number.isInteger(a)||l<0||l>=a||o.length===3&&u!==null&&u!==void 0&&typeof u!="string")return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a non-negative half-open range with integer from/to values and from below to.'};l<t&&n.push([l,Math.min(a,t)])}n.sort((i,o)=>i[0]===o[0]?i[1]-o[1]:i[0]-o[0]);let r=[];for(let i of n){let o=r[r.length-1];o&&i[0]<=o[1]?o[1]=Math.max(o[1],i[1]):r.push(i)}return{ok:!0,value:r}}function kn(e,t){var y,_,c,w,p,A,C,W;if(t===void 0)return D;let n=t!=null?t:{},r=Object.keys(n),i;for(let T in n)if(!H(n,T)){i=T;break}let o=r.find(T=>!Tn.includes(T)),l=Object.getOwnPropertySymbols(n).find(T=>Mt(n,T));if(o!==void 0||i!==void 0||l!==void 0){let T=(y=o!=null?o:i)!=null?y:String(l);throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ".concat(JSON.stringify(T),"."))}let a=Object.create(null);for(let T of r)a[T]=n[T];for(let T of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(T in a&&typeof a[T]!="boolean")throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_05] option ".concat(JSON.stringify(T)," must be Boolean, but it was ").concat(g(a[T],4),"."));if("targetLanguage"in a&&!["html","css","js"].includes(a.targetLanguage))throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_06] option "targetLanguage" must be exactly "html", "css", or "js", but it was '.concat(g(a.targetLanguage,4),"."));for(let T of["minWordCount","minCharCount"]){let E=a[T];if(T in a&&E!==!1&&E!==null&&(typeof E!="number"||!Number.isFinite(E)||E<0))throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_07] option ".concat(JSON.stringify(T)," must be a finite non-negative number, false, or null, but it was ").concat(g(E,4),"."))}let u=Cn("ignore"in a?a.ignore:D.ignore);if(!u.ok)throw u.kind==="shape"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_08] ".concat(u.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_09] ".concat(u.detail));let f="reportProgressFunc"in a?a.reportProgressFunc:D.reportProgressFunc;if(f!==!1&&f!==null&&typeof f!="function")throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was '.concat(g(f,4),"."));for(let T of["reportProgressFuncFrom","reportProgressFuncTo"]){let E=T in a?a[T]:D[T];if(typeof E!="number"||!Number.isInteger(E)||E<0||E>100)throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_11] option ".concat(JSON.stringify(T)," must be an integer from 0 through 100, but it was ").concat(g(E,4),"."))}let d=(_=a.reportProgressFuncFrom)!=null?_:D.reportProgressFuncFrom,h=(c=a.reportProgressFuncTo)!=null?c:D.reportProgressFuncTo;if(d>h)throw new RangeError('string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" ('.concat(d,') must not exceed "reportProgressFuncTo" (').concat(h,")."));let m=En("tagRanges"in a?a.tagRanges:[],e.length);if(!m.ok)throw m.kind==="container"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_13] ".concat(m.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_14] ".concat(m.detail));return{removeWidowPreventionMeasures:(w=a.removeWidowPreventionMeasures)!=null?w:D.removeWidowPreventionMeasures,convertEntities:(p=a.convertEntities)!=null?p:D.convertEntities,targetLanguage:(A=a.targetLanguage)!=null?A:D.targetLanguage,UKPostcodes:(C=a.UKPostcodes)!=null?C:D.UKPostcodes,hyphens:(W=a.hyphens)!=null?W:D.hyphens,minWordCount:"minWordCount"in a?a.minWordCount:D.minWordCount,minCharCount:"minCharCount"in a?a.minCharCount:D.minCharCount,ignore:u.value,reportProgressFunc:typeof f=="function"?f:null,reportProgressFuncFrom:d,reportProgressFuncTo:h,tagRanges:m.value}}return Qt(On);})();
10
+ "use strict";var stringRemoveWidows=(()=>{var he=Object.defineProperty,Yt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptor,en=Object.getOwnPropertyDescriptors,tn=Object.getOwnPropertyNames,ht=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var Re=(e,t,n)=>t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t)=>{for(var n in t||(t={}))mt.call(t,n)&&Re(e,n,t[n]);if(ht)for(var n of ht(t))nn.call(t,n)&&Re(e,n,t[n]);return e},yt=(e,t)=>Yt(e,en(t));var rn=(e,t)=>{for(var n in t)he(e,n,{get:t[n],enumerable:!0})},on=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tn(t))!mt.call(e,i)&&i!==n&&he(e,i,{get:()=>t[i],enumerable:!(r=Xt(t,i))||r.enumerable});return e};var sn=e=>on(he({},"__esModule",{value:!0}),e);var ne=(e,t,n)=>Re(e,typeof t!="symbol"?t+"":t,n);var Hn={};rn(Hn,{defaults:()=>Cn,removeWidows:()=>En,version:()=>Tn});function an(){let e=[],t=0,n=!1;return{append(r){return n?!1:t+r.length>1999?(e.push("\u2026"),t+=1,n=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return n}}}function ln(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function me(e,t){if(e.append('"')){for(let n=0;n<t.length&&!e.stopped();n+=1){let r=t.charCodeAt(n);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(ln(r)):e.append(t[n])}e.append('"')}}function un(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function wt(e,t){e.append("Symbol(");let n=String(t);n.length>8&&me(e,n.slice(7,-1)),e.append(")")}function bt(e,t){typeof t=="symbol"?wt(e,t):me(e,String(t))}function p(e,t=0){let n=an(),r=t===4?4:0,i=new WeakSet,o=0;function l(c){r&&n.append(" ".repeat(c*r))}function u(c,m){c&&n.append(","),r&&(n.append("\n"),l(m+1))}function a(c,m,A){r&&m&&(n.append("\n"),l(A)),n.append(c)}function _(c,m){Object.prototype.hasOwnProperty.call(c,"value")?y(c.value,m):n.append(un(c))}function f(c,m){let A;try{A=Reflect.getOwnPropertyDescriptor(c,"length")}catch(W){n.append("[Uninspectable]");return}let h=A==null?void 0:A.value;if(!Number.isSafeInteger(h)||h<0){n.append("[Uninspectable]");return}n.append("[");let T=!1;for(let W=0;W<h&&!n.stopped();W+=1){if(u(T,m),T=!0,o>=50){n.append("[MaxEntries]");break}o+=1;let R;try{R=Reflect.getOwnPropertyDescriptor(c,String(W))}catch(b){n.append("[Uninspectable]");continue}R!=null&&R.enumerable?_(R,m+1):n.append("[Empty]")}a("]",T,m)}function d(c,m){let A;try{A=Reflect.ownKeys(c)}catch(T){n.append("[Uninspectable]");return}n.append("{");let h=!1;for(let T of A){if(n.stopped())break;if(o>=50){u(h,m),h=!0,me(n,"\u2026"),n.append(r?": ":":"),n.append("[MaxEntries]");break}o+=1;let W;try{W=Reflect.getOwnPropertyDescriptor(c,T)}catch(R){u(h,m),h=!0,bt(n,T),n.append(r?": ":":"),n.append("[Uninspectable]");continue}W!=null&&W.enumerable&&(u(h,m),h=!0,bt(n,T),n.append(r?": ":":"),_(W,m+1))}a("}",h,m)}function g(c,m){if(i.has(c)){n.append("[Circular]");return}if(m>=5){n.append("[MaxDepth]");return}let A;try{A=Array.isArray(c)}catch(h){n.append("[Uninspectable]");return}i.add(c);try{A?f(c,m):d(c,m)}finally{i.delete(c)}}function y(c,m){c===null?n.append("null"):typeof c=="string"?me(n,c):typeof c=="number"?n.append(Object.is(c,-0)?"-0":String(c)):typeof c=="boolean"?n.append(c?"true":"false"):typeof c>"u"?n.append("undefined"):typeof c=="bigint"?n.append("".concat(c,"n")):typeof c=="symbol"?wt(n,c):typeof c=="function"?n.append("[Function]"):g(c,m)}try{return y(e,0),n.result()}catch(c){return"[Uninspectable]"}}var _n=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),De=_n.slice(1).split("_"),xe=[],vt=127;for(let e=0;e<De.length;e+=2){let t=vt+1+Number.parseInt(De[e],36),n=t+Number.parseInt(De[e+1],36);xe.push([t,n]),vt=n}function fn(e){if(Number.isNaN(e)||e<128||e>1114111)return!1;let t=0,n=xe.length-1;for(;t<=n;){let r=t+n>>1,i=xe[r];if(e<i[0])n=r-1;else if(e>i[1])t=r+1;else return!0}return!1}var je="\u2013",Pe="\u2014",re="\xA0";var zn=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"]);var Wt=Function.prototype.toString,dn=Wt.call(Object);var Un=Map.prototype.entries,qn=Set.prototype.values;var $t,Jn=($t=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:$t.get,At,Kn=(At=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:At.get,Tt,Gn=(Tt=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:Tt.get,Ct,Qn=(Ct=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:Ct.get,Zn=RegExp.prototype.test;function cn(e){if(e.length===1){let t=e.charCodeAt(0);return t<55296||t>57343?t:-1}if(e.length===2){let t=e.charCodeAt(0),n=e.charCodeAt(1);if(t>=55296&&t<=56319&&n>=56320&&n<=57343)return(t-55296)*1024+n-56320+65536}return-1}function kt(e){if(!H(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>64&&t<91||t>96&&t<123:fn(cn(e))}function S(e){var r;if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.getOwnPropertyDescriptor(t,"constructor");return!n||!("value"in n)||typeof n.value!="function"?!1:((r=Object.getOwnPropertyDescriptor(n.value,"prototype"))==null?void 0:r.value)===t&&Wt.call(n.value)===dn}function H(e){return typeof e=="string"}function Ie(e){return Number.isFinite(e)}function oe(e){return Number.isSafeInteger(e)&&e>=0}var Yn=Date.prototype.getTime;function ye(e){return e!=null}var Ot={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function gn(e,t){let n,r=0;for(;r<e.length;){let i=r+1;for(;i<e.length&&e[r][0]===e[i][0]&&e[r][1]===e[i][1];)i+=1;if(i-r>1){n||(n=new Map(t.map((u,a)=>[u,a])));let o=n,l=e.slice(r,i).sort((u,a)=>o.get(u)-o.get(a));e.splice(r,l.length,...l)}r=i}return e}function Z(e,t){var u;if(!Array.isArray(e)||!e.length)return e;let n=t===void 0?!0:S(t);if(t!==void 0&&n&&(t==null?void 0:t.strictlyTwoElementsInRangeArrays)===!0)for(let a=0;a<e.length;a+=1){let _=e[a];if(!Array.isArray(_)||_.length!==2)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, range at index ".concat(a," (").concat(p(_,4),") is ").concat(Array.isArray(_)?"an array with ".concat(_.length," elements"):"not an array","!"));if(!Number.isInteger(_[0])||_[0]<0||!Number.isInteger(_[1])||_[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, range at index ".concat(a," (").concat(p(_,4),") does not consist of only natural numbers!"))}else for(let a=0;a<e.length;a+=1){let _=e[a];if(!Array.isArray(_)||!Number.isInteger(_[0])||_[0]<0||!Number.isInteger(_[1])||_[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, range at index ".concat(a," (").concat(p(_,4),") does not consist of only natural numbers!"))}if(t!==void 0&&!n)throw new TypeError("ranges-sort/rSort(): [THROW_ID_03] The second argument must be a plain options object; received ".concat(p(t,4)," (type ").concat(typeof t,")!"));let r=Ot.progressFn;if(t!==void 0){let a=t.strictlyTwoElementsInRangeArrays;if(a!==void 0&&typeof a!="boolean")throw new TypeError("ranges-sort/rSort(): [THROW_ID_04] opts.strictlyTwoElementsInRangeArrays must be a boolean; received ".concat(p(a,4)," (type ").concat(typeof a,")!"));if(r=(u=t.progressFn)!=null?u:Ot.progressFn,r!==!1&&r!==null&&typeof r!="function")throw new TypeError("ranges-sort/rSort(): [THROW_ID_05] opts.progressFn must be a function, false, null, or undefined; received ".concat(p(r,4)," (type ").concat(typeof r,")!"))}let i,o;if(r){let a=e.length**2,_=0,f;o=d=>{d!==f&&(f=d,r(d))},i=Array.from(e).sort((d,g)=>(_+=1,o==null||o(Math.min(99,Math.floor(_*100/a))),d[0]===g[0]?d[1]<g[1]?-1:d[1]>g[1]?1:0:d[0]<g[0]?-1:1))}else i=Array.from(e).sort((a,_)=>a[0]===_[0]?a[1]<_[1]?-1:a[1]>_[1]?1:0:a[0]<_[0]?-1:1);let l=i.length>10?gn(i,e):i;return o==null||o(100),l}var pn={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Se(e,t){if(!Array.isArray(e)||!e.length)return null;if(t!==void 0&&!S(t))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(p(t,4)," (type ").concat(typeof t,")"));let n=Q(Q({},pn),t);if(n.progressFn&&S(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(p(n.progressFn,4)));if(n.mergeType!==1&&n.mergeType!==2&&n.mergeType!=="1"&&n.mergeType!=="2")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(p(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(p(n.joinRangesThatTouchEdges,4)));let r=n.progressFn,i=n.joinRangesThatTouchEdges,o=[];for(let y of e)Array.isArray(y)&&(y[2]!==void 0||y[0]!==y[1])&&o.push([...y]);let l,u,a;r?l=Z(o,{progressFn:y=>{a=Math.floor(y/5),a!==u&&(u=a,r(a))}}):l=Z(o);let _=l.length-1,f=n.mergeType===2||n.mergeType==="2",d=l.length;for(let y=_;y>=0;y--){let c=l[y];for(r&&y<_&&(a=Math.floor((1-(y+1)/_)*78)+21,a!==u&&a>u&&(u=a,r(a)));d<l.length;){let m=l[d],A=m[0]===c[0];if(!A&&(i?m[0]>c[1]:m[0]>=c[1]))break;let h=m[1]>=c[1];h&&(c[1]=m[1]),m[2]===null?c[2]=null:m[2]!==void 0&&(A||h)&&c[2]!==null&&(c[2]!=null?f&&A?c[2]=m[2]:c[2]+=m[2]:c[2]=m[2]),d+=1}d-=1,l[d]=c}let g=l.length-d;for(let y=0;y<g;y++)l[y]=l[d+y];return l.length=g,r&&u!==99&&r(99),l.length?l:null}function be(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let t=Number(e);return Number.isInteger(t)&&t>=0}function Et(e,t,n){let r=0,i=0;if(e===void 0&&t===void 0&&n===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(p(e,4)));if(t!=null&&!Array.isArray(t))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof t,", equal to: ").concat(p(t,4)));if(n!=null&&n!==!1&&n!==0&&n!==""&&typeof n!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function, false, null, undefined, 0, or an empty string! Currently it's: ".concat(typeof n,", equal to: ").concat(p(n,4)));if(t==null||!t.length||t.every(f=>f==null))return n&&n(100),e;let o;Array.isArray(t)&&!Array.isArray(t[0])&&be(t[0])&&be(t[1])?o=[Array.from(t)]:o=Array.from(t);let l=o.length,u=0;o.forEach((f,d)=>{if(f){if(n&&(r=Math.floor(u/l*10),r!==i&&(i=r,n(r))),!Array.isArray(f))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(d,"th element not an array: ").concat(p(f,4),", which is ").concat(typeof f));if(!be(f[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(d,"th element, array ").concat(p(f),". Its first element is not a non-negative integer or string index, but ").concat(typeof f[0],", equal to: ").concat(p(f[0],4),"."));if(typeof f[0]=="string"&&(o[d]=[...f],o[d][0]=Number(f[0])),!be(f[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(d,"th element, array ").concat(p(f),". Its second element is not a non-negative integer or string index, but ").concat(typeof f[1],", equal to: ").concat(p(f[1],4),"."));if(typeof f[1]=="string"&&(o[d]===f&&(o[d]=[...f]),o[d][1]=Number(f[1])),o[d][0]>o[d][1])throw new RangeError("ranges-apply/rApply(): [THROW_ID_08] ranges array, second input arg. has ".concat(d,"th element, array ").concat(p(f),". Its first index (").concat(o[d][0],") must not be greater than its second index (").concat(o[d][1],")."));u+=1}});let a=n?Se(o,{progressFn:f=>{r=10+Math.floor(f/10),r!==i&&(i=r,n(r))}}):Se(o),_=(a==null?void 0:a.length)||0;if(a&&_>0){let f=e.slice(a[_-1][1]);e=a.reduce((d,g,y,c)=>{var h;n&&(r=20+Math.floor(y/_*80),r!==i&&(i=r,n(r)));let m=y===0?0:c[y-1][1],A=c[y][0];return"".concat(d).concat(e.slice(m,A)).concat((h=c[y][2])!=null?h:"")},""),e+=f}return n&&i!==100&&n(100),e}function we(e,t=1){let n="\xA0";function r(o){return o.length<2?o:Array.from(o).reverse().join("")}function i(o,l,u){let a=u?"\n":"\r",_=u?"\r":"\n";if(!o)return o;let f=0,d="";for(let g=0,y=o.length;g<y;g++)(o[g]===a||o[g]===_&&o[g-1]!==a)&&f++,"\r\n".includes(o[g])||o[g]===n?o[g]===n?d+=o[g]:o[g]===a?f<=l&&(d+=o[g],o[g+1]===_&&(d+=o[g+1],g++)):o[g]===_&&(o==null?void 0:o[g-1])!==a&&f<=l&&(d+=o[g]):!o[g+1]&&!f&&(d+=" ");return d}if(typeof e=="string"&&e.length){let o=e.trim();if(o.length===e.length)return e;let l=1;typeof t=="number"&&Number.isInteger(t)&&t>=0&&(l=t);let u="",a="";if(!o)u=e;else if(!e[0].trim()){for(let f=0,d=e.length;f<d;f++)if(e[f].trim()){u=e.slice(0,f);break}}let _=e[e.length-1];if(o&&(_.trim()===""||_===n)){for(let f=e.length;f--;)if(e[f].trim()){a=e.slice(f+1);break}}return"".concat(i(u,l,!1)).concat(o).concat(r(i(r(a),l,!0)))}return e}var Ne={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Rt(e,t,n){return t===void 0||e===null?e:t===null?null:e===void 0||n?t:e+t}function hn(e,t){var c,m,A;function n(h){return!!h&&typeof h=="object"&&!Array.isArray(h)}if(!Array.isArray(e)||!e.length)return null;if(t&&!n(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_07] the second input argument must be a plain object. It was given as:\n".concat(p(t,4)," (type ").concat(typeof t,")"));let r=(c=t==null?void 0:t.progressFn)!=null?c:Ne.progressFn,i=(m=t==null?void 0:t.mergeType)!=null?m:Ne.mergeType,o=(A=t==null?void 0:t.joinRangesThatTouchEdges)!=null?A:Ne.joinRangesThatTouchEdges;if(r&&n(r)&&!Object.keys(r).length)r=null;else if(r&&typeof r!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_08] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof r,'", equal to ').concat(p(r,4)));if(i!==1&&i!==2&&i!=="1"&&i!=="2")throw new TypeError('ranges-push/rMerge(): [THROW_ID_09] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof i,'", equal to ').concat(p(i,4)));if(typeof o!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_10] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof o,'", equal to ').concat(p(o,4)));let l=[];for(let h of e)Array.isArray(h)&&(h[2]!==void 0||h[0]!==h[1])&&l.push([...h]);let u,a,_;r?u=Z(l,{progressFn:h=>{_=Math.floor(h/5),_!==a&&(a=_,r==null||r(_))}}):u=Z(l);let f=u.length-1,d=+i==2,g=u.length;for(let h=f;h>=0;h--){let T=u[h];for(r&&h<f&&(_=Math.floor((1-(h+1)/f)*78)+21,_!==a&&_>a&&(a=_,r(_)));g<u.length;){let W=u[g],R=W[0]===T[0];if(!R&&(o?W[0]>T[1]:W[0]>=T[1]))break;let b=W[1]>=T[1];b&&(T[1]=W[1]),W[2]===null?T[2]=null:W[2]!==void 0&&(R||b)&&(T[2]=Rt(T[2],W[2],d&&R)),g+=1}g-=1,u[g]=T}let y=u.length-g;for(let h=0;h<y;h++)u[h]=u[g+h];return u.length=y,u.length?u:null}var ve=Object.freeze({limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1});function V(e){if(oe(e))return e;if(typeof e=="string"&&/^\d+$/.test(e)){let t=Number(e);return oe(t)?t:null}return null}function Dt(e){if(!Array.isArray(e))return"a ranges batch must contain only range arrays; received ".concat(p(e,4));if(e.length>3)return"a range must contain at most three values; received ".concat(p(e,4));let[t,n,r]=e;if(t==null&&n==null)return;if(t!=null&&n==null)return"the first index is set (".concat(p(t),") but the second index is not (").concat(p(n),")");if(t==null&&n!=null)return"the second index is set (".concat(p(n),") but the first index is not (").concat(p(t),")");let i=V(t),o=V(n);if(i===null)return"the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(p(t,4)," (type ").concat(typeof t,")");if(o===null)return"the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(p(n,4)," (type ").concat(typeof n,")");if(ye(r)&&!H(r)&&!Ie(r))return"the third value must be a string, number, null, or undefined; received ".concat(p(r,4)," (type ").concat(typeof r,")");if(i>o)return"the first index (".concat(i,") must not be greater than the second index (").concat(o,")")}function mn(e){if(e.length>3)return{error:"expected at most three arguments but received ".concat(e.length),ranges:[]};if(e.length<=1&&Array.isArray(e[0])){let n=e[0];if(!n.length)return{ranges:[]};e=Array.isArray(n[0])?n:[n]}else e=[e];let t=[];for(let n of e){let r=Dt(n);if(r)return{error:r,ranges:[]};let[i,o,l]=n;if(i==null&&o==null)continue;let u=V(i),a=V(o);t.push(l!==void 0&&!(H(l)&&!l.length)?[u,a,l]:[u,a])}return{ranges:t}}function yn(e){return e[2]===void 0&&e[0]===e[1]}function bn(e){let t=-1;for(let n=0,r=e.length;n<r;n++){let i=e[n];if(Array.isArray(i)){if(i[0]<t)return!1;t=i[0]}}return!0}var xt=class{constructor(e){ne(this,"ranges");ne(this,"opts");ne(this,"currentCache",null);if(e!=null&&!S(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(p(e,4)," (type ").concat(typeof e,")."));if(e===void 0){this.opts=ve,this.ranges=[];return}let t=e,n=t.limitToBeAddedWhitespace===void 0?ve.limitToBeAddedWhitespace:t.limitToBeAddedWhitespace,r=t.limitLinebreaksCount===void 0?ve.limitLinebreaksCount:t.limitLinebreaksCount,i=t.mergeType===void 0?ve.mergeType:t.mergeType,o=i==="1"?1:i==="2"?2:i,l;if(typeof n!="boolean"?l="opts.limitToBeAddedWhitespace must be a boolean; received ".concat(p(n,4)," (type ").concat(typeof n,")"):oe(r)?o!==1&&o!==2&&(l='opts.mergeType must be 1, 2, "1", or "2"; received '.concat(p(i,4)," (type ").concat(typeof i,")")):l="opts.limitLinebreaksCount must be a natural number or zero; received ".concat(p(r,4)," (type ").concat(typeof r,")"),l)throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_02] ".concat(l,"."));let u=Object.freeze({limitToBeAddedWhitespace:n,limitLinebreaksCount:r,mergeType:o});this.opts=u,this.ranges=[]}rangeListsMatch(e,t){if(!Array.isArray(e))return t===null;if(!Array.isArray(t)||e.length!==t[0])return!1;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!Array.isArray(o)){if(t[n++]!==-1||o!==t[n++])return!1;continue}if(o.length!==t[n++])return!1;for(let l=0;l<o.length;l++)if(o[l]!==t[n++])return!1}return n===t.length}snapshotRanges(e){if(!Array.isArray(e))return null;let t=new Array(1+e.length*4);t[0]=e.length;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(Array.isArray(o)){t[n++]=o.length;for(let l=0;l<o.length;l++)t[n++]=o[l]}else t[n++]=-1,t[n++]=o}return t.length=n,t}currentStateMatchesSnapshot(){let e=this.currentCache;return e!==null&&this.rangeListsMatch(this.ranges,e.rangesSnapshot)&&this.rangeListsMatch(e.result,e.resultSnapshot)}recordCurrentSnapshot(e){let t=this.snapshotRanges(this.ranges);this.currentCache={rangesSnapshot:t,result:e,resultSnapshot:e===this.ranges?t:this.snapshotRanges(e)}}invalidateCurrentCache(){this.currentCache=null}addValidated(e,t,n){this.invalidateCurrentCache();let r=this.last();if(ye(this.ranges)&&Array.isArray(r)&&e===r[1]){if(r[1]=t,n!==void 0&&!(H(n)&&!n.length)){let o=Rt(r[2],n,this.opts.mergeType===2&&r[0]===e);this.opts.limitToBeAddedWhitespace&&typeof o=="string"&&(o=we(o,this.opts.limitLinebreaksCount)),H(o)&&!o.length||(r[2]=o)}return}this.ranges||(this.ranges=[]);let i=n!==void 0?[e,t,typeof n=="string"&&this.opts.limitToBeAddedWhitespace?we(n,this.opts.limitLinebreaksCount):n]:[e,t];this.ranges.push(i)}add(e,t,n){let r=arguments.length,i;if(r>3)i="expected at most three arguments but received ".concat(r);else if(r===1&&Array.isArray(e)){let o=Array.isArray(e[0])?e:[e];for(let l=0,u=o.length;l<u&&(i=Dt(o[l]),!i);l++);if(!i)for(let l=0,u=o.length;l<u;l++){let[a,_,f]=o[l];a==null&&_==null||this.addValidated(V(a),V(_),H(f)&&!f.length?void 0:f)}}else{if(e==null&&t==null)return;if(e!=null&&t==null)i="the first index is set (".concat(p(e),") but the second index is not (").concat(p(t),")");else if(e==null&&t!=null)i="the second index is set (".concat(p(t),") but the first index is not (").concat(p(e),")");else{let o=V(e),l=V(t);o===null?i="the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(p(e,4)," (type ").concat(typeof e,")"):l===null?i="the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(p(t,4)," (type ").concat(typeof t,")"):ye(n)&&!H(n)&&!Ie(n)?i="the third value must be a string, number, null, or undefined; received ".concat(p(n,4)," (type ").concat(typeof n,")"):o>l?i="the first index (".concat(o,") must not be greater than the second index (").concat(l,")"):this.addValidated(o,l,H(n)&&!n.length?void 0:n)}}if(i)throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_03] ".concat(i,"."))}push(e,t,n){this.add.apply(this,arguments)}current(){var e,t;if(this.currentStateMatchesSnapshot())return(t=(e=this.currentCache)==null?void 0:e.result)!=null?t:null;if(Array.isArray(this.ranges)&&this.ranges.length){this.ranges=hn(this.ranges,this.opts.mergeType===1?void 0:{mergeType:2});let n=this.ranges;return n&&this.opts.limitToBeAddedWhitespace&&(n=n.map(r=>typeof r[2]=="string"?[r[0],r[1],we(r[2],this.opts.limitLinebreaksCount)]:r)),this.recordCurrentSnapshot(n),n}return this.recordCurrentSnapshot(null),null}firstCovers(e){if(!oe(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_04] the input argument must be a natural number or zero! It was given as ".concat(p(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=bn(this.ranges)?this.ranges:this.ranges.filter(r=>Array.isArray(r)).slice().sort((r,i)=>r[0]-i[0]||r[1]-i[1]),n=null;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!(!Array.isArray(o)||yn(o))){if(n===null){if(o[0]!==0)return!1;n=o[1]}else{if(o[0]>n)break;o[1]>n&&(n=o[1])}if(n>=e)return!0}}return n!==null&&n>=e}wipe(){this.ranges=[],this.invalidateCurrentCache()}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])){let t=mn([e]);if(t.error)throw new TypeError("ranges-push/Ranges/replace(): [THROW_ID_06] ".concat(t.error,"."));this.ranges=t.ranges,this.invalidateCurrentCache()}else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_05] Single range was given but we expected array of arrays! The first element, ".concat(p(e[0],4)," should be an array."));else this.ranges=[],this.invalidateCurrentCache()}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};function Y(e){return e===32||e>=9&&e<=13||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function jt(e,t){return t==null?0:typeof t!="number"||!Number.isInteger(t)||t<0?null:t>e?e:t}function wn(e,t){return t===-1?-1:jt(e,t)}function Pt(e,t=0){if(typeof e!="string"||!e.length)return null;let n=wn(e.length,t);if(n===null||n+1>=e.length)return null;let r=n+1;if(!Y(e.charCodeAt(r)))return r;if(r+=1,r>=e.length)return null;if(!Y(e.charCodeAt(r)))return r;for(r+=1;r<e.length;r++)if(!Y(e.charCodeAt(r)))return r;return null}function $e(e,t=0){if(typeof e!="string"||!e.length)return null;let n=jt(e.length,t);if(n===null||n<1)return null;let r=n-1;if(!Y(e.charCodeAt(r)))return r;if(r-=1,r<0)return null;if(!Y(e.charCodeAt(r)))return r;for(r-=1;r>=0;r--)if(!Y(e.charCodeAt(r)))return r;return null}var It="4.2.6";function Me(e){return e===32||e>=9&&e<=13&&e!==11}function Fe(e,t,n=!0){let r=t+(e[t+1]==="/"?2:1),i=e.charCodeAt(r)|32;if(i<97||i>122)return;for(r+=1;r<e.length;){let a=e.charCodeAt(r);if(a<=62&&(Me(a)||a===47||a===34||a===39||a>=60&&a<=62))break;r+=1}if(e[r]&&!Me(e.charCodeAt(r))&&e[r]!=="/"&&e[r]!==">")return;let o,l=!1,u=!1;for(;r<e.length;r+=1){let a=e[r];if(o)a===o&&(o=void 0);else{if(a===">")return r+1;if(a==="<")return n?r:void 0;Me(e.charCodeAt(r))?u=!1:l?(l=!1,a==='"'||a==="'"?o=a:u=!0):a==="="&&!u&&(l=!0)}}return n?e.length:void 0}var $n=new Set(["address","article","aside","blockquote","body","br","caption","center","dd","details","dialog","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"]),An=new Set(["script","style","pre","code","textarea","title"]);function Ae(e,t){if(e.startsWith("<!--",t)||e.startsWith("<![CDATA[",t)){let a=e.startsWith("<!--",t)?"-->":"]]>",_=e.indexOf(a,t+4);return{end:_<0?e.length:_+a.length,boundary:!1}}if(e.startsWith("<?",t)){let a=e.indexOf("?>",t+2);return{end:a<0?e.length:a+2,boundary:!1}}if(e.startsWith("<!",t)){let a,_=0;for(let f=t+2;f<e.length;f+=1){let d=e[f];if(a)d===a&&(a=void 0);else if(d==='"'||d==="'")a=d;else if(d==="[")_+=1;else if(d==="]")_=Math.max(0,_-1);else if(d===">"&&!_)return{end:f+1,boundary:!1}}return{end:e.length,boundary:!1}}let n=Fe(e,t);if(n===void 0)return;let r=e[t+1]==="/",i=t+(r?2:1),o=i;for(;o<n&&!/[\t\n\f\r />]/.test(e[o]);)o+=1;let l=e.slice(i,o).toLowerCase(),u=$n.has(l)||l==="script"||l==="style";if(!r&&An.has(l)&&e[n-1]===">"){let a=n,_=1;for(;a<e.length&&(a=e.indexOf("<",a),a!==-1);){if((l==="pre"||l==="code")&&(e[a+1]==="!"||e[a+1]==="?")){a=Ae(e,a).end;continue}let f=e[a+1]==="/",d=a+(f?2:1);if(e.slice(d,d+l.length).toLowerCase()===l&&/[\t\n\f\r />]/.test(e[d+l.length]||"")&&(f||l==="pre"||l==="code")){let g=Fe(e,a,!1);if(g!==void 0){if(_+=f?-1:1,!_)return{end:g,boundary:u};a=g;continue}}if(l==="pre"||l==="code"){if(/^<(script|style|textarea|title)(?=[\t\n\f\r />])/i.exec(e.slice(a,a+11))){a=Ae(e,a).end;continue}let y=Fe(e,a);if(y!==void 0){a=y;continue}}a+=1}return{end:e.length,boundary:u}}return{end:n,boundary:u}}function St(e,t,n){let r=[],i=t;for(;i<e.length;){let o=e.indexOf("{%",i);if(o<0)break;let l=e.indexOf("%}",o+2);if(l<0)break;let u=/^-?\s*(if|for|endif|endfor)(?=[\s%-]|$)/.exec(e.slice(o+2,l));if(u&&!n(o,l+2)){let a=u[1];if(a==="if"||a==="for")r.push(a);else if(r[r.length-1]===a.slice(3)&&(r.pop(),!r.length))return l+2}i=l+2}}var X="&nbsp;",He="\\0000A0",Le="\\u00A0",Nt="&ndash;";var Mt="\\u2013",Ft="&mdash;";var Ht="\\u2014",ie=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Lt=[{heads:"{{",tails:"}}"}],Be=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}];var Tn=It,Jt=4,Kt=5,x={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:Jt,minCharCount:Kt,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},Cn=Object.freeze(yt(Q({},x),{ignore:Object.freeze([]),tagRanges:Object.freeze([])})),Wn=[Nt,Mt,Ft,Ht],kn=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function On(e,t){var f,d;let n=0,r=0,i,o,l;for(let g=0;g<e.length;g+=1)if(e[g].trim())r+=1,(f=e[g-1])!=null&&f.trim()||(n+=1),i!==void 0&&(o=i,l=g,i=void 0);else if((d=e[g-1])!=null&&d.trim()){let y=g+1;for(;y<e.length&&!e[y].trim();)y+=1;y<e.length&&(i=g)}let u=!1,a=null,_=e;return o!==void 0&&l!==void 0&&n>=Jt&&r>=Kt&&(u=!0,a=[[o,l,X]],_="".concat(e.slice(0,o)).concat(X).concat(e.slice(l))),{res:_,ranges:a,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:u,convertEntities:!1},applicableOpts:{removeWidows:u,convertEntities:u}}}function En(e,t){var tt,nt,rt,ot,it,st,at,lt,ut,_t,ft,dt;let n=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error('string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "'.concat(typeof e,'", equal to:\n').concat(p(e,4)));if(t!==void 0&&!S(t))throw new Error("string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ".concat(typeof t,", equal to ").concat(p(t,4)));if(t===void 0&&!kn.test(e))return On(e,n);let r=Array.isArray,i=e.length,o=new Map,l=["."],u=.06,a,_,f=0,d=0,g=0,y,c,m,A,h,T,W=[],R=[],b,k,N,j,O,L=0,qe=[],B,ee,J,te,w=Fn(e,t),Je={removeWidows:!1,convertEntities:!1},U={removeWidows:!1,convertEntities:!1},le=new Map,ue=new Set;function Ke(s,v){return"".concat(s,":").concat(v)}function Ge(s,v,C){if(!s.length||v>=C)return!1;let E=0,F=s.length;for(;E<F;){let K=Math.floor((E+F)/2);s[K][1]<=v?E=K+1:F=K}return!!(s[E]&&s[E][0]<C)}function M(s,v){return Ge(w.tagRanges,s,v)||Ge(qe,s,v)}function _e(s,v){return e.startsWith(s,v)&&!M(v,v+s.length)}function Qe(s,v){return(typeof s.heads=="string"?_e(s.heads,v):s.heads.some(E=>_e(E,v)))&&(!s.nestedBlock||/^\{%-?\s*(if|for)(?=[\s%-]|$)/.test(e.slice(v,v+12)))}let Te=w.reportProgressFuncFrom+Math.floor((w.reportProgressFuncTo-w.reportProgressFuncFrom)*(1-u));function Ce(s){if(!w.reportProgressFunc)return;let v=Math.max(w.reportProgressFuncFrom,Math.min(w.reportProgressFuncTo,Math.floor(s)));(_===void 0||v>_)&&(_=v,w.reportProgressFunc(v))}function fe(s,v){if(M(s,v))return!1;let C=re;w.removeWidowPreventionMeasures?C=" ":w.convertEntities&&(C=X,w.targetLanguage==="css"?C=He:w.targetLanguage==="js"&&(C=Le));let E=Ke(s,v),F=se(e,s)===v;return U.removeWidows=!0,F&&(w.removeWidowPreventionMeasures?ue.delete(E):ue.add(E)),e.slice(s,v)!==C?(o.set(E,[s,v,C]),le.set(E,F&&C!==" "?"convertEntities":"removeWidows"),!0):(o.delete(E),le.delete(E),!1)}function We(){d=0,g=0,y=void 0,c=void 0,m=void 0,A=void 0,h=void 0,T=void 0,W=[],R=[],b=void 0,k=void 0,N=void 0,j=void 0}function Ze(){let s,v;if(m!==void 0&&A!==void 0&&b!==void 0&&k!==void 0?m>b?(s=m,v=A):(s=b,v=k):m!==void 0&&A!==void 0?(s=m,v=A):b!==void 0&&k!==void 0&&(s=b,v=k),(s===void 0||v===void 0)&&y!==void 0&&c!==void 0&&(s=y,v=c),s!==void 0&&v!==void 0&&(!w.minWordCount||d>=w.minWordCount)&&(!w.minCharCount||g>=w.minCharCount)&&!M(s,v))if(U.removeWidows=!0,s===m&&v===A)for(let[C,E]of R)fe(C,E);else fe(s,v);We()}function Ye(s){h!==void 0&&(y=m,c=A,m=h,A=T!=null?T:s,R=W,R.push([m,A]),W=[],h=void 0,T=void 0)}We(),Ce(w.reportProgressFuncFrom);for(let s=0;s<=i;s++){for(w.reportProgressFunc&&(a=w.reportProgressFuncFrom+Math.floor((i===0?1:Math.min(s,i)/i)*(Te-w.reportProgressFuncFrom)),Ce(a));w.tagRanges[L]&&w.tagRanges[L][1]<=s;)L+=1;let C=w.tagRanges[L],E=!1;if(!O&&e[s]==="<"&&(!C||s<=C[0])&&!w.ignore.some($=>Qe($,s))){let $=Ae(e,s);$&&(C=[s,$.end],E=$.boundary)}if(C&&s>=C[0]&&s<C[1]){for(C=[C[0],C[1]];w.tagRanges[L]&&w.tagRanges[L][0]<C[1];)C[1]=Math.max(C[1],w.tagRanges[L][1]),L+=1;qe.push(C);let $=B===s||ee===s||J!==s&&te!==s&&!((tt=e[s-1])!=null&&tt.trim());E?(Ze(),f=C[1]):h!==void 0&&T===void 0&&(T=s),B=void 0,J=void 0,ee=void 0,te=void 0,(E||$)&&(ee=C[1]),s=C[1]-1;continue}let F=ee===s;F&&(ee=void 0);let K=te===s;K&&(te=void 0);let ct=J===s;if(ct&&(J=void 0),!O&&r(w.ignore)&&w.ignore.length){let $=!1;if(w.ignore.some((I,ge)=>{var pe;if(Qe(I,s)){if(Ye(s),d+=1,j!==void 0&&(b=N,k=j),I.nestedBlock){let q=St(e,s,M);return q===void 0?(We(),s=i-1,$=!0,!0):((pe=e[q])!=null&&pe.trim()&&(B=q),s=q-1,$=!0,!0)}return O=w.ignore[ge].tails,!0}return!1}),$)continue}let ke=!1;!O&&B!==void 0&&B===s&&(d+=1,j!==void 0&&(b=N,k=j),B=void 0,ke=!0);let Oe=!O&&(e[s]===re||e[s]==="&"||e[s]==="\\")?se(e,s):void 0,D=Oe!==void 0&&!M(s,Oe)?Oe:void 0;if(!O&&((nt=e[s])!=null&&nt.trim())&&D===void 0&&Ye(s),D!==void 0){h=void 0,T=void 0,W=[],N=s,j=D;let $=Ke(s,D);ue.add($);let I=w.convertEntities?w.targetLanguage==="css"?"".concat(He).concat(ze(e[D])?" ":""):w.targetLanguage==="js"?Le:X:re;e.slice(s,D)!==I&&(o.set($,[s,D,I]),le.set($,"convertEntities")),e[D]&&!"\r\n".includes(e[D])&&!e[D].trim()&&(J=D),D-s>1&&((rt=e[D])!=null&&rt.trim())&&se(e,D)===void 0&&(B=D),s=D-1;continue}!O&&((ot=e[s])!=null&&ot.trim())&&(g+=1);let Ee=!O&&(e[s]==="-"||e[s]===Pe||e[s]===je||e[s]==="&"||e[s]==="\\")?Rn(e,s):void 0,P=Ee!==void 0&&!M(s,Ee)?Ee:void 0;if(P!==void 0){let $=$e(e,s);!ke&&(F||!((it=e[s-1])!=null&&it.trim()))&&(d+=1,j!==void 0&&(b=N,k=j));let I=N!==void 0&&j===s&&se(e,N)===s,ge=I&&N!==void 0?N:$===null?s:$+1,pe=$!==null&&$>=f&&!e.slice($+1,s).split("").some(pt=>pt==="\r"||pt==="\n"),q=P<i&&pe&&!((st=e[P])!=null&&st.trim())&&(I||!!e[s-1]&&!e[s-1].trim()&&$!==null)&&!M(ge,s);q&&(U.removeWidows=!0),w.hyphens&&q&&fe(ge,s),e[s]==="\\"&&ze(e[P-1])&&(e[P]&&!"\r\n".includes(e[P])&&!e[P].trim()?J=P:(at=e[P])!=null&&at.trim()&&(te=P)),s=P-1;continue}!O&&!ke&&((lt=e[s])!=null&&lt.trim())&&(F||!K&&!((ut=e[s-1])!=null&&ut.trim()))&&(d+=1,j!==void 0&&(b=N,k=j)),!O&&(!e[s]||"\r\n".includes(e[s])||(e[s]==="\n"||e[s]==="\r"||e[s]==="\r"&&e[s+1]==="\n")&&$e(e,s)&&l.includes(e[$e(e,s)]))&&(Ze(),f=s+1);let de=e.charCodeAt(s-1),ce=!O&&e[s]&&!e[s].trim()&&!"\r\n".includes(e[s])&&((_t=e[s-1])!=null&&_t.trim())&&(de>=48&&de<=57||de>=65&&de<=90)?Pn(e,s):void 0;ce!==void 0&&!M(ce.tokenStart,ce.tokenEnd)&&(U.removeWidows=!0,w.UKPostcodes&&fe(s,ce.whitespaceEnd)),!O&&e[s]&&!e[s].trim()&&!"\r\n".includes(e[s])&&h!==void 0&&T!==void 0&&(W.push([h,T]),h=s,T=void 0);let gt=!O&&e[s]&&!"\r\n".includes(e[s])&&!e[s].trim()&&(ct||((ft=e[s-1])==null?void 0:ft.trim()))&&h===void 0,Zt=gt?Pt(e,s):null;gt&&Zt!==null&&(h=s,T=void 0);let G;if(O&&(typeof O=="string"&&_e(O,s)?G=O:Array.isArray(O)&&O.some($=>_e($,s)?(G=$,!0):!1),G!==void 0)){let $=s+G.length;if(G.startsWith("{% end")||G.startsWith("{%- end")){for(;$<i&&!e[$].trim();)$+=1;e.startsWith("-%}",$)?$+=3:e.startsWith("%}",$)&&($+=2)}if(!M(s,$)){O=void 0;let I=se(e,$);(dt=e[$])!=null&&dt.trim()&&(I===void 0||M($,I))&&(B=$),s=$-1}}e[s]&&"\r\n".includes(e[s])&&(d=0,g=0)}let Xe=new xt({mergeType:2});for(let s of o.values())Xe.push(s);let et=Xe.current(),Qt=Et(e,et,w.reportProgressFunc?s=>{a=Te+Math.floor(s/100*(w.reportProgressFuncTo-Te)),Ce(a)}:void 0);for(let s of le.values())Je[s]=!0;return U.convertEntities=U.removeWidows&&!w.removeWidowPreventionMeasures||ue.size>0,{res:Qt,ranges:et,log:{timeTakenInMilliseconds:Date.now()-n},whatWasDone:Je,applicableOpts:U}}function Bt(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function ze(e){return e!==void 0&&" \n\f\r ".includes(e)}function Ue(e,t,n,r){if(e[t]!=="\\"||!Bt(e[t+1]))return;let i=t+1;for(;i<e.length&&i-t<=6&&Bt(e[i]);)i+=1;if(Number.parseInt(e.slice(t+1,i),16)===n)return r&&ze(e[i])?e[i]==="\r"&&e[i+1]==="\n"?i+2:i+1:i}function se(e,t){var r,i;let n=e[t];if(n===re)return t+1;if(n==="&"&&(e.startsWith(X,t)||e.startsWith("&#160;",t)))return t+6;if(n==="\\")return((r=e[t+1])==null?void 0:r.toLowerCase())==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&((i=e[t+4])==null?void 0:i.toLowerCase())==="a"&&e[t+5]==="0"?t+6:Ue(e,t,160,!0)}function Rn(e,t){var r;let n=e[t];if(n==="-"||n===Pe||n===je)return t+1;if(n==="&"||n==="\\"){for(let i of Wn)if(e.startsWith(i,t))return t+i.length;if(n==="\\")return(r=Ue(e,t,8211,!0))!=null?r:Ue(e,t,8212,!0)}}function Vt(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122}var Ve=[1632,1641,1776,1785,1984,1993,2406,2415,2534,2543,2662,2671,2790,2799,2918,2927,3046,3055,3174,3183,3302,3311,3430,3439,3558,3567,3664,3673,3792,3801,3872,3881,4160,4169,4240,4249,6112,6121,6160,6169,6470,6479,6608,6617,6784,6793,6800,6809,6992,7001,7088,7097,7232,7241,7248,7257,42528,42537,43216,43225,43264,43273,43472,43481,43504,43513,43600,43609,44016,44025,65296,65305,66720,66729,68912,68921,68928,68937,69734,69743,69872,69881,69942,69951,70096,70105,70384,70393,70736,70745,70864,70873,71248,71257,71360,71369,71376,71395,71472,71481,71904,71913,72016,72025,72688,72697,72784,72793,73040,73049,73120,73129,73184,73193,73552,73561,90416,90425,92768,92777,92864,92873,93008,93017,93552,93561,118e3,118009,120782,120831,123200,123209,123632,123641,124144,124153,124401,124410,125264,125273,130032,130041];function Dn(e,t){let n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function xn(e,t){if(t<=0)return;let n=e.charCodeAt(t-1);return n>=56320&&n<=57343&&t>1?e.slice(t-2,t):e[t-1]}function jn(e){if(e===void 0)return!1;let t=e.codePointAt(0),n=0,r=Ve.length/2-1;for(;n<=r;){let i=n+r>>1,o=Ve[i*2],l=Ve[i*2+1];if(t<o)r=i-1;else if(t>l)n=i+1;else return!0}return!1}function zt(e){return e!==void 0&&(e==="_"||kt(e)||jn(e))}function Pn(e,t){var u;if(!e[t]||"\r\n".includes(e[t])||e[t].trim()||!((u=e[t-1])!=null&&u.trim()))return;let n=e.charCodeAt(t-1);if(!(n>=48&&n<=57||n>=65&&n<=90))return;let r=t;for(;e[r]&&!e[r].trim()&&!"\r\n".includes(e[r]);)r+=1;if(!e[r])return;let i=e.charCodeAt(r);if(i<48||i>57)return;let o=t-1;for(;o>=0&&Vt(e[o]);)o-=1;o+=1;let l=r;for(;l<e.length&&Vt(e[l]);)l+=1;if(!(zt(xn(e,o))||zt(Dn(e,l))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(o,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(r,l))?{whitespaceEnd:r,tokenStart:o,tokenEnd:l}:void 0}var In=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function ae(e){return{nestedBlock:e===ie[1]||e===ie[2],heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function z(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Gt(e,t){var n;return((n=Object.getOwnPropertyDescriptor(e,t))==null?void 0:n.enumerable)===!0}function Sn(e){for(let t in e)if(!z(e,t))return t}function Ut(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let n=0;n<e.length;n+=1){if(!z(e,n))return;let r=e[n];if(typeof r!="string"||r.length===0)return;t.push(r)}return t}function qt(e,t){let n=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(n))return'option "ignore" contains an unsupported preset '.concat(JSON.stringify(t),".");n==="all"?e.push(...ie.map(ae),...Be.map(ae)):["nunjucks","jinja","liquid"].includes(n)?e.push(...ie.map(ae)):n==="hugo"?e.push(...Lt.map(ae)):e.push(...Be.map(ae))}function Nn(e){let t=[];if(typeof e=="string"){let n=qt(t,e);return n?{ok:!1,kind:"preset",detail:n}:{ok:!0,value:t}}if(!Array.isArray(e))return{ok:!1,kind:"shape",detail:'option "ignore" must be a supported preset or an array of presets and { heads, tails } marker objects, but it was '.concat(p(e,4),".")};for(let n=0;n<e.length;n+=1){if(!z(e,n))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let r=e[n];if(typeof r=="string"){let a=qt(t,r);if(a)return{ok:!1,kind:"preset",detail:a};continue}if(!S(r)||Sn(r)!==void 0||Object.getOwnPropertySymbols(r).some(a=>Gt(r,a)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let i=Object.keys(r);if(i.length!==2||!i.includes("heads")||!i.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let o=r,l=Ut(o.heads),u=Ut(o.tails);if(l===void 0||u===void 0)return{ok:!1,kind:"shape",detail:"custom ignore marker heads and tails must be non-empty strings or dense arrays of non-empty strings."};t.push({heads:l,tails:u})}return{ok:!0,value:t}}function Mn(e,t){if(e===null)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,kind:"container",detail:'option "tagRanges" must be null or an array of half-open ranges, but it was '.concat(p(e,4),".")};let n=[];for(let i=0;i<e.length;i+=1){if(!z(e,i))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let o=e[i];if(!Array.isArray(o)||o.length!==2&&o.length!==3||!z(o,0)||!z(o,1)||o.length===3&&!z(o,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let l=o[0],u=o[1],a=o.length===3?o[2]:void 0;if(!Number.isInteger(l)||!Number.isInteger(u)||l<0||l>=u||o.length===3&&a!==null&&a!==void 0&&typeof a!="string")return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a non-negative half-open range with integer from/to values and from below to.'};l<t&&n.push([l,Math.min(u,t)])}n.sort((i,o)=>i[0]===o[0]?i[1]-o[1]:i[0]-o[0]);let r=[];for(let i of n){let o=r[r.length-1];o&&i[0]<=o[1]?o[1]=Math.max(o[1],i[1]):r.push(i)}return{ok:!0,value:r}}function Fn(e,t){var y,c,m,A,h,T,W,R;if(t===void 0)return x;let n=t!=null?t:{},r=Object.keys(n),i;for(let b in n)if(!z(n,b)){i=b;break}let o=r.find(b=>!In.includes(b)),l=Object.getOwnPropertySymbols(n).find(b=>Gt(n,b));if(o!==void 0||i!==void 0||l!==void 0){let b=(y=o!=null?o:i)!=null?y:String(l);throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ".concat(JSON.stringify(b),"."))}let u=Object.create(null);for(let b of r)u[b]=n[b];for(let b of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(b in u&&typeof u[b]!="boolean")throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_05] option ".concat(JSON.stringify(b)," must be Boolean, but it was ").concat(p(u[b],4),"."));if("targetLanguage"in u&&!["html","css","js"].includes(u.targetLanguage))throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_06] option "targetLanguage" must be exactly "html", "css", or "js", but it was '.concat(p(u.targetLanguage,4),"."));for(let b of["minWordCount","minCharCount"]){let k=u[b];if(b in u&&k!==!1&&k!==null&&(typeof k!="number"||!Number.isFinite(k)||k<0))throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_07] option ".concat(JSON.stringify(b)," must be a finite non-negative number, false, or null, but it was ").concat(p(k,4),"."))}let a=Nn("ignore"in u?u.ignore:x.ignore);if(!a.ok)throw a.kind==="shape"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_08] ".concat(a.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_09] ".concat(a.detail));let _="reportProgressFunc"in u?u.reportProgressFunc:x.reportProgressFunc;if(_!==!1&&_!==null&&typeof _!="function")throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was '.concat(p(_,4),"."));for(let b of["reportProgressFuncFrom","reportProgressFuncTo"]){let k=b in u?u[b]:x[b];if(typeof k!="number"||!Number.isInteger(k)||k<0||k>100)throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_11] option ".concat(JSON.stringify(b)," must be an integer from 0 through 100, but it was ").concat(p(k,4),"."))}let f=(c=u.reportProgressFuncFrom)!=null?c:x.reportProgressFuncFrom,d=(m=u.reportProgressFuncTo)!=null?m:x.reportProgressFuncTo;if(f>d)throw new RangeError('string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" ('.concat(f,') must not exceed "reportProgressFuncTo" (').concat(d,")."));let g=Mn("tagRanges"in u?u.tagRanges:[],e.length);if(!g.ok)throw g.kind==="container"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_13] ".concat(g.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_14] ".concat(g.detail));return{removeWidowPreventionMeasures:(A=u.removeWidowPreventionMeasures)!=null?A:x.removeWidowPreventionMeasures,convertEntities:(h=u.convertEntities)!=null?h:x.convertEntities,targetLanguage:(T=u.targetLanguage)!=null?T:x.targetLanguage,UKPostcodes:(W=u.UKPostcodes)!=null?W:x.UKPostcodes,hyphens:(R=u.hyphens)!=null?R:x.hyphens,minWordCount:"minWordCount"in u?u.minWordCount:x.minWordCount,minCharCount:"minCharCount"in u?u.minCharCount:x.minCharCount,ignore:a.value,reportProgressFunc:typeof _=="function"?_:null,reportProgressFuncFrom:f,reportProgressFuncTo:d,tagRanges:g.value}}return sn(Hn);})();
11
11
  /**
12
12
  * @name codsen-format-diagnostic-value
13
13
  * @fileoverview Safely format untrusted JavaScript values for diagnostics
@@ -19,7 +19,7 @@
19
19
  /**
20
20
  * @name codsen-utils
21
21
  * @fileoverview Various utility functions
22
- * @version 1.10.1
22
+ * @version 1.10.2
23
23
  * @author Roy Revelt
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/codsen-utils/}
@@ -27,7 +27,7 @@
27
27
  /**
28
28
  * @name ranges-sort
29
29
  * @fileoverview Sort string index ranges
30
- * @version 6.2.3
30
+ * @version 6.2.4
31
31
  * @author Roy Revelt
32
32
  * @license MIT
33
33
  * {@link https://codsen.com/os/ranges-sort/}
@@ -35,7 +35,7 @@
35
35
  /**
36
36
  * @name ranges-merge
37
37
  * @fileoverview Merge and sort string index ranges
38
- * @version 9.2.4
38
+ * @version 9.2.5
39
39
  * @author Roy Revelt
40
40
  * @license MIT
41
41
  * {@link https://codsen.com/os/ranges-merge/}
@@ -43,7 +43,7 @@
43
43
  /**
44
44
  * @name ranges-apply
45
45
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
46
- * @version 7.2.4
46
+ * @version 7.2.5
47
47
  * @author Roy Revelt
48
48
  * @license MIT
49
49
  * {@link https://codsen.com/os/ranges-apply/}
@@ -59,7 +59,7 @@
59
59
  /**
60
60
  * @name ranges-push
61
61
  * @fileoverview Gather string index ranges
62
- * @version 7.3.1
62
+ * @version 7.3.2
63
63
  * @author Roy Revelt
64
64
  * @license MIT
65
65
  * {@link https://codsen.com/os/ranges-push/}
@@ -67,7 +67,7 @@
67
67
  /**
68
68
  * @name string-left-right
69
69
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
70
- * @version 6.2.3
70
+ * @version 6.2.4
71
71
  * @author Roy Revelt
72
72
  * @license MIT
73
73
  * {@link https://codsen.com/os/string-left-right/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-remove-widows",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "description": "Helps to prevent widow words in a text",
5
5
  "keywords": [
6
6
  "against",
@@ -71,13 +71,13 @@
71
71
  }
72
72
  },
73
73
  "dependencies": {
74
- "codsen-utils": "^1.10.1",
75
- "ranges-apply": "^7.2.4",
76
- "ranges-push": "^7.3.1",
77
- "string-left-right": "^6.2.3"
74
+ "codsen-utils": "^1.10.2",
75
+ "ranges-apply": "^7.2.5",
76
+ "ranges-push": "^7.3.2",
77
+ "string-left-right": "^6.2.4"
78
78
  },
79
79
  "devDependencies": {
80
- "string-strip-html": "^13.7.1"
80
+ "string-strip-html": "^13.7.3"
81
81
  },
82
82
  "engines": {
83
83
  "node": ">=18.20.8"