string-remove-widows 4.0.15 → 4.0.16

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.
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 4.0.15
4
+ * @version 4.0.16
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-remove-widows/}
8
8
  */
9
9
 
10
- import{matchRightIncl as Q}from"string-match-left-right";import{left as T,right as D}from"string-left-right";import{Ranges as X}from"ranges-push";import{rApply as q}from"ranges-apply";import{rawNbsp as w,rawNDash as ee,rawMDash as te}from"codsen-utils";var R="4.0.15";var f="&nbsp;",E="\\00A0",S="\\u00A0",j="&ndash;",M="\\2013",J="\\u2013",U="&mdash;",k="\\2014",I="\\u2014",C=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],B=[{heads:"{{",tails:"}}"}],P=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],_=["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 ce=R,oe={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function me(t,h){let G=Date.now();if(typeof t!="string")throw t===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof t}", equal to:
11
- ${JSON.stringify(t,null,4)}`);if(h&&typeof h!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof h}, equal to ${JSON.stringify(h,null,4)}`);let b=Array.isArray,L=t.length,a=new X({mergeType:2}),K=["."],Z=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,Y=/^[0-9][A-Z]{2}/,V=.06,$,A=0,g=0,W=0,y,N,d,c,r,l,s,p,o={...oe,...h},m={removeWidows:!1,convertEntities:!1};if(!o.ignore||!b(o.ignore)&&typeof o.ignore!="string")o.ignore=[];else if(typeof o.ignore=="string"&&(o.ignore=[o.ignore]),o.ignore.includes("all"))o.ignore=o.ignore.concat(C.concat(P));else if(o.ignore.some(e=>typeof e=="string")){let e=[];o.ignore=o.ignore.filter(i=>typeof i=="string"&&i.length?(["nunjucks","jinja","liquid"].includes(i.trim().toLowerCase())?e=e.concat(C):["hugo"].includes(i.trim().toLowerCase())?e=e.concat(B):["hexo"].includes(i.trim().toLowerCase())&&(e=e.concat(P)),!1):typeof i=="object"),e.length&&(o.ignore=o.ignore.concat(e))}let x;o.reportProgressFunc&&(x=Math.floor(o.reportProgressFuncTo-(o.reportProgressFuncTo-o.reportProgressFuncFrom)*V-o.reportProgressFuncFrom));function v(e,i){let n=w;o.removeWidowPreventionMeasures?n=" ":o.convertEntities&&(n=f,typeof o.targetLanguage=="string"&&(o.targetLanguage.trim().toLowerCase()==="css"?n=E:o.targetLanguage.trim().toLowerCase()==="js"&&(n=S))),t.slice(e,i)!==n&&a.push(e,i,n)}function O(){g=0,W=0,y=void 0,N=void 0,d=void 0,c=void 0,r=void 0,l=void 0}O();for(let e=0;e<=L;e++){if(!s&&b(o.ignore)&&o.ignore.length&&o.ignore.some((n,u)=>{if(b(n.heads)&&n.heads.some(H=>t.startsWith(H,e))||typeof n.heads=="string"&&t.startsWith(n.heads,e))return g+=1,s=o.ignore[u].tails,!0}),!s&&p&&p===e&&(g+=1,p=void 0),typeof o.reportProgressFunc=="function"&&($=o.reportProgressFuncFrom+Math.floor(e/L*(x||1)),$!==A&&(A=$,o.reportProgressFunc($))),!s&&e&&t[e]&&t[e].trim()&&(!t[e-1]||t[e-1]&&!t[e-1].trim())&&(c=e),!s&&t[e]&&t[e].trim()&&(W+=1),!s&&o.hyphens&&(`-${te}${ee}`.includes(t[e])||t.startsWith(j,e)||t.startsWith(M,e)||t.startsWith(J,e)||t.startsWith(U,e)||t.startsWith(k,e)||t.startsWith(I,e))&&t[e+1]&&(!t[e+1].trim()||t[e]==="&")&&t[e-1]&&!t[e-1].trim()&&t[T(t,e)]&&(v(T(t,e)+1,e),m.removeWidows=!0),!s&&(t.startsWith("&nbsp;",e)||t.startsWith("&#160;",e))&&(r=e,l=e+6,t[e+6]&&t[e+6].trim()&&(p=e+6),o.convertEntities?(o.targetLanguage==="css"||o.targetLanguage==="js")&&(a.push(e,e+6,o.targetLanguage==="css"?E:S),m.convertEntities=!0):(a.push(e,e+6,w),m.convertEntities=!0)),!s&&t[e+4]&&t[e]==="\\"&&t[e+1]==="0"&&t[e+2]==="0"&&t[e+3].toUpperCase()==="A"&&t[e+4]==="0"&&(r=e,l=e+5,t[e+5]&&t[e+5].trim()&&(p=e+5),o.convertEntities?(o.targetLanguage==="html"||o.targetLanguage==="js")&&(a.push(e,e+5,o.targetLanguage==="html"?f:S),m.convertEntities=!0):(a.push(e,e+5,w),m.convertEntities=!0)),!s&&t[e]==="\\"&&t[e+1]&&t[e+1].toLowerCase()==="u"&&t[e+2]==="0"&&t[e+3]==="0"&&t[e+4]&&t[e+4].toUpperCase()==="A"&&t[e+5]==="0"&&(r=e,l=e+6,t[e+6]&&t[e+6].trim()&&(p=e+6),o.convertEntities?(o.targetLanguage==="html"||o.targetLanguage==="css")&&a.push(e,e+6,o.targetLanguage==="html"?f:E):a.push(e,e+6,w)),!s&&t[e]===w&&(r=e,l=e+1,o.convertEntities&&a.push(e,e+1,o.targetLanguage==="css"?E:o.targetLanguage==="js"?S:f)),!s&&t[e]&&t[e].trim()&&(!t[e-1]||!t[e-1].trim())&&(g+=1),!s&&(!t[e]||`\r
10
+ import{matchRightIncl as Q}from"string-match-left-right";import{left as T,right as D}from"string-left-right";import{Ranges as X}from"ranges-push";import{rApply as q}from"ranges-apply";import{rawNbsp as w,rawNDash as ee,rawMDash as te}from"codsen-utils";var R="4.0.16";var f="&nbsp;",E="\\00A0",S="\\u00A0",j="&ndash;",M="\\2013",J="\\u2013",U="&mdash;",k="\\2014",I="\\u2014",C=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],B=[{heads:"{{",tails:"}}"}],P=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],_=["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 ce=R,oe={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function me(t,h){let G=Date.now();if(typeof t!="string")throw t===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof t}", equal to:
11
+ ${JSON.stringify(t,null,4)}`);if(h&&typeof h!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof h}, equal to ${JSON.stringify(h,null,4)}`);let b=Array.isArray,L=t.length,a=new X({mergeType:2}),K=["."],Z=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,Y=/^[0-9][A-Z]{2}/,V=.06,$,A=0,g=0,W=0,y,N,u,c,r,d,s,p,o={...oe,...h},m={removeWidows:!1,convertEntities:!1};if(!o.ignore||!b(o.ignore)&&typeof o.ignore!="string")o.ignore=[];else if(typeof o.ignore=="string"&&(o.ignore=[o.ignore]),o.ignore.includes("all"))o.ignore=o.ignore.concat(C.concat(P));else if(o.ignore.some(e=>typeof e=="string")){let e=[];o.ignore=o.ignore.filter(i=>typeof i=="string"&&i.length?(["nunjucks","jinja","liquid"].includes(i.trim().toLowerCase())?e=e.concat(C):["hugo"].includes(i.trim().toLowerCase())?e=e.concat(B):["hexo"].includes(i.trim().toLowerCase())&&(e=e.concat(P)),!1):typeof i=="object"),e.length&&(o.ignore=o.ignore.concat(e))}let x;o.reportProgressFunc&&(x=Math.floor(o.reportProgressFuncTo-(o.reportProgressFuncTo-o.reportProgressFuncFrom)*V-o.reportProgressFuncFrom));function v(e,i){let n=w;o.removeWidowPreventionMeasures?n=" ":o.convertEntities&&(n=f,typeof o.targetLanguage=="string"&&(o.targetLanguage.trim().toLowerCase()==="css"?n=E:o.targetLanguage.trim().toLowerCase()==="js"&&(n=S))),t.slice(e,i)!==n&&a.push(e,i,n)}function O(){g=0,W=0,y=void 0,N=void 0,u=void 0,c=void 0,r=void 0,d=void 0}O();for(let e=0;e<=L;e++){if(!s&&b(o.ignore)&&o.ignore.length&&o.ignore.some((n,l)=>{if(b(n.heads)&&n.heads.some(H=>t.startsWith(H,e))||typeof n.heads=="string"&&t.startsWith(n.heads,e))return g+=1,s=o.ignore[l].tails,!0}),!s&&p&&p===e&&(g+=1,p=void 0),typeof o.reportProgressFunc=="function"&&($=o.reportProgressFuncFrom+Math.floor(e/L*(x||1)),$!==A&&(A=$,o.reportProgressFunc($))),!s&&e&&t[e]?.trim()&&(!t[e-1]||t[e-1]&&!t[e-1].trim())&&(c=e),!s&&t[e]?.trim()&&(W+=1),!s&&o.hyphens&&(`-${te}${ee}`.includes(t[e])||t.startsWith(j,e)||t.startsWith(M,e)||t.startsWith(J,e)||t.startsWith(U,e)||t.startsWith(k,e)||t.startsWith(I,e))&&t[e+1]&&(!t[e+1].trim()||t[e]==="&")&&t[e-1]&&!t[e-1].trim()&&t[T(t,e)]&&(v(T(t,e)+1,e),m.removeWidows=!0),!s&&(t.startsWith("&nbsp;",e)||t.startsWith("&#160;",e))&&(r=e,d=e+6,t[e+6]?.trim()&&(p=e+6),o.convertEntities?(o.targetLanguage==="css"||o.targetLanguage==="js")&&(a.push(e,e+6,o.targetLanguage==="css"?E:S),m.convertEntities=!0):(a.push(e,e+6,w),m.convertEntities=!0)),!s&&t[e+4]&&t[e]==="\\"&&t[e+1]==="0"&&t[e+2]==="0"&&t[e+3].toUpperCase()==="A"&&t[e+4]==="0"&&(r=e,d=e+5,t[e+5]?.trim()&&(p=e+5),o.convertEntities?(o.targetLanguage==="html"||o.targetLanguage==="js")&&(a.push(e,e+5,o.targetLanguage==="html"?f:S),m.convertEntities=!0):(a.push(e,e+5,w),m.convertEntities=!0)),!s&&t[e]==="\\"&&t[e+1]&&t[e+1].toLowerCase()==="u"&&t[e+2]==="0"&&t[e+3]==="0"&&t[e+4]&&t[e+4].toUpperCase()==="A"&&t[e+5]==="0"&&(r=e,d=e+6,t[e+6]?.trim()&&(p=e+6),o.convertEntities?(o.targetLanguage==="html"||o.targetLanguage==="css")&&a.push(e,e+6,o.targetLanguage==="html"?f:E):a.push(e,e+6,w)),!s&&t[e]===w&&(r=e,d=e+1,o.convertEntities&&a.push(e,e+1,o.targetLanguage==="css"?E:o.targetLanguage==="js"?S:f)),!s&&t[e]?.trim()&&!t[e-1]?.trim()&&(g+=1),!s&&(!t[e]||`\r
12
12
  `.includes(t[e])||(t[e]===`
13
13
  `||t[e]==="\r"||t[e]==="\r"&&t[e+1]===`
14
- `)&&T(t,e)&&K.includes(t[T(t,e)]))){if((!o.minWordCount||g>=o.minWordCount)&&(!o.minCharCount||W>=o.minCharCount)){let n,u;d!==void 0&&c!==void 0&&r!==void 0&&l!==void 0?d>r?(n=d,u=c):(n=r,u=l):d!==void 0&&c!==void 0?(n=d,u=c):r!==void 0&&l!==void 0&&(n=r,u=l),!(n&&u)&&y&&N&&(n=y,u=N),n&&u&&(v(n,u),m.removeWidows=!0)}O()}o.UKPostcodes&&t[e]&&!t[e].trim()&&t[e-1]&&t[e-1].trim()&&Z.test(t.slice(0,e))&&t[D(t,e)]&&Y.test(t.slice(D(t,e)))&&(v(e,D(t,e)),m.removeWidows=!0),!s&&t[e]&&!t[e].trim()&&t[e-1]&&t[e-1].trim()&&(d===void 0||t[d-1]&&t[d-1].trim())&&!"/>".includes(t[D(t,e)])&&!t.slice(0,e).trim().endsWith("br")&&!t.slice(0,e).trim().endsWith("hr")&&!(t.slice(0,e).endsWith("<")&&_.some(n=>t.startsWith(n,D(t,e))))&&(y=d,N=c,d=e,c=void 0,(r!==void 0||l!==void 0)&&(r=void 0,l=void 0));let i;s&&(typeof s=="string"&&(!s.length||t.startsWith(s,e))?s=void 0:b(s)&&(!s.length||s.some(n=>{if(t.startsWith(n,e))return i=n,!0}))&&(s=void 0,e+=i.length,b(o.ignore)&&o.ignore.length&&t[e+1]&&o.ignore.some(n=>Q(t,e,n.tails,{trimBeforeMatching:!0,cb:(u,H,F)=>(F&&(e=F-1,t[e+1]&&t[e+1].trim()&&(g+=1)),!0)})))),t[e]&&`\r
14
+ `)&&T(t,e)&&K.includes(t[T(t,e)]))){if((!o.minWordCount||g>=o.minWordCount)&&(!o.minCharCount||W>=o.minCharCount)){let n,l;u!==void 0&&c!==void 0&&r!==void 0&&d!==void 0?u>r?(n=u,l=c):(n=r,l=d):u!==void 0&&c!==void 0?(n=u,l=c):r!==void 0&&d!==void 0&&(n=r,l=d),!(n&&l)&&y&&N&&(n=y,l=N),n&&l&&(v(n,l),m.removeWidows=!0)}O()}o.UKPostcodes&&t[e]&&!t[e].trim()&&t[e-1]?.trim()&&Z.test(t.slice(0,e))&&t[D(t,e)]&&Y.test(t.slice(D(t,e)))&&(v(e,D(t,e)),m.removeWidows=!0),!s&&t[e]&&!t[e].trim()&&t[e-1]?.trim()&&(u===void 0||t[u-1]?.trim())&&!"/>".includes(t[D(t,e)])&&!t.slice(0,e).trim().endsWith("br")&&!t.slice(0,e).trim().endsWith("hr")&&!(t.slice(0,e).endsWith("<")&&_.some(n=>t.startsWith(n,D(t,e))))&&(y=u,N=c,u=e,c=void 0,(r!==void 0||d!==void 0)&&(r=void 0,d=void 0));let i;s&&(typeof s=="string"&&(!s.length||t.startsWith(s,e))?s=void 0:b(s)&&(!s.length||s.some(n=>{if(t.startsWith(n,e))return i=n,!0}))&&(s=void 0,e+=i.length,b(o.ignore)&&o.ignore.length&&t[e+1]&&o.ignore.some(n=>Q(t,e,n.tails,{trimBeforeMatching:!0,cb:(l,H,F)=>(F&&(e=F-1,t[e+1]?.trim()&&(g+=1)),!0)})))),t[e]&&`\r
15
15
  `.includes(t[e])&&(g=0,W=0),b(o.tagRanges)&&o.tagRanges.length&&o.tagRanges.some(n=>{if(e>=n[0]&&e<=n[1]&&n[1]-1>e)return e=n[1]-1,!0})}return q(t,a.current()).split("").forEach((e,i)=>{}),{res:q(t,a.current(),o.reportProgressFunc?e=>{$=Math.floor((o.reportProgressFuncTo-o.reportProgressFuncFrom)*(1-V)+e/100*(o.reportProgressFuncTo-o.reportProgressFuncFrom)*V),$!==A&&(A=$,o.reportProgressFunc($))}:void 0),ranges:a.current(),log:{timeTakenInMilliseconds:Date.now()-G},whatWasDone:m}}export{oe as defaults,me as removeWidows,ce as version};
@@ -1,37 +1,37 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 4.0.15
4
+ * @version 4.0.16
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-remove-widows/}
8
8
  */
9
9
 
10
- "use strict";var stringRemoveWidows=(()=>{var Oe=Object.create;var j=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames,re=Object.getOwnPropertySymbols,xe=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable;var q=(e,r,a)=>r in e?j(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,A=(e,r)=>{for(var a in r||(r={}))ne.call(r,a)&&q(e,a,r[a]);if(re)for(var a of re(r))Ie.call(r,a)&&q(e,a,r[a]);return e};var Le=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Ve=(e,r)=>{for(var a in r)j(e,a,{get:r[a],enumerable:!0})},se=(e,r,a,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Me(r))!ne.call(e,u)&&u!==a&&j(e,u,{get:()=>r[u],enumerable:!(i=Re(r,u))||i.enumerable});return e};var ie=(e,r,a)=>(a=e!=null?Oe(xe(e)):{},se(r||!e||!e.__esModule?j(a,"default",{value:e,enumerable:!0}):a,e)),je=e=>se(j({},"__esModule",{value:!0}),e);var k=(e,r,a)=>(q(e,typeof r!="symbol"?r+"":r,a),a);var Q=Le((tt,ae)=>{"use strict";ae.exports=Fe;function M(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Fe(e){if(e=e||{},e.circles)return _e(e);return e.proto?i:a;function r(u,t){for(var l=Object.keys(u),o=new Array(l.length),g=0;g<l.length;g++){var n=l[g],c=u[n];typeof c!="object"||c===null?o[n]=c:c instanceof Date?o[n]=new Date(c):ArrayBuffer.isView(c)?o[n]=M(c):o[n]=t(c)}return o}function a(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,a);if(u instanceof Map)return new Map(r(Array.from(u),a));if(u instanceof Set)return new Set(r(Array.from(u),a));var t={};for(var l in u)if(Object.hasOwnProperty.call(u,l)!==!1){var o=u[l];typeof o!="object"||o===null?t[l]=o:o instanceof Date?t[l]=new Date(o):o instanceof Map?t[l]=new Map(r(Array.from(o),a)):o instanceof Set?t[l]=new Set(r(Array.from(o),a)):ArrayBuffer.isView(o)?t[l]=M(o):t[l]=a(o)}return t}function i(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,i);if(u instanceof Map)return new Map(r(Array.from(u),i));if(u instanceof Set)return new Set(r(Array.from(u),i));var t={};for(var l in u){var o=u[l];typeof o!="object"||o===null?t[l]=o:o instanceof Date?t[l]=new Date(o):o instanceof Map?t[l]=new Map(r(Array.from(o),i)):o instanceof Set?t[l]=new Set(r(Array.from(o),i)):ArrayBuffer.isView(o)?t[l]=M(o):t[l]=i(o)}return t}}function _e(e){var r=[],a=[];return e.proto?t:u;function i(l,o){for(var g=Object.keys(l),n=new Array(g.length),c=0;c<g.length;c++){var p=g[c],h=l[p];if(typeof h!="object"||h===null)n[p]=h;else if(h instanceof Date)n[p]=new Date(h);else if(ArrayBuffer.isView(h))n[p]=M(h);else{var m=r.indexOf(h);m!==-1?n[p]=a[m]:n[p]=o(h)}}return n}function u(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return i(l,u);if(l instanceof Map)return new Map(i(Array.from(l),u));if(l instanceof Set)return new Set(i(Array.from(l),u));var o={};r.push(l),a.push(o);for(var g in l)if(Object.hasOwnProperty.call(l,g)!==!1){var n=l[g];if(typeof n!="object"||n===null)o[g]=n;else if(n instanceof Date)o[g]=new Date(n);else if(n instanceof Map)o[g]=new Map(i(Array.from(n),u));else if(n instanceof Set)o[g]=new Set(i(Array.from(n),u));else if(ArrayBuffer.isView(n))o[g]=M(n);else{var c=r.indexOf(n);c!==-1?o[g]=a[c]:o[g]=u(n)}}return r.pop(),a.pop(),o}function t(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return i(l,t);if(l instanceof Map)return new Map(i(Array.from(l),t));if(l instanceof Set)return new Set(i(Array.from(l),t));var o={};r.push(l),a.push(o);for(var g in l){var n=l[g];if(typeof n!="object"||n===null)o[g]=n;else if(n instanceof Date)o[g]=new Date(n);else if(n instanceof Map)o[g]=new Map(i(Array.from(n),t));else if(n instanceof Set)o[g]=new Set(i(Array.from(n),t));else if(ArrayBuffer.isView(n))o[g]=M(n);else{var c=r.indexOf(n);c!==-1?o[g]=a[c]:o[g]=t(n)}}return r.pop(),a.pop(),o}}});var Ye={};Ve(Ye,{defaults:()=>Ce,removeWidows:()=>ze,version:()=>Ze});function oe(e){return typeof e!="string"?e:e.length?[e]:[]}var le=ie(Q(),1);var rt=(0,le.default)();var ue="\u2013",ge="\u2014",x="\xA0";function F(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function N(e){return typeof e=="string"}function O(e){return Number.isSafeInteger(e)&&e>=0}function R(e){return e!=null}function fe(e,r){return F(e)&&N(r)&&r in e}var ce={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},He=e=>e+1;function Pe(e,r,a,i,u=!1,t=He){let l=typeof a=="function"?a():a;if(+r<0&&u&&l==="EOL")return l;let o=A(A({},ce),i);if(r>=e.length&&!u)return!1;let g=u?1:a.length,n=0,c=!1,p=!1,h=!1,m=o.maxMismatches,d=r,v=!1,y=!1,T=!1;function w(){return n===1&&m<o.maxMismatches-1}for(;e[d];){let b=t(d);if(o.trimBeforeMatching&&e[d].trim()===""){if(!e[b]&&u&&a==="EOL")return!0;d=t(d);continue}if(o&&!o.i&&o.trimCharsBeforeMatching&&o.trimCharsBeforeMatching.includes(e[d])||o!=null&&o.i&&o.trimCharsBeforeMatching&&o.trimCharsBeforeMatching.map(S=>S.toLowerCase()).includes(e[d].toLowerCase())){if(u&&a==="EOL"&&!e[b])return!0;d=t(d);continue}let E=b>d?a[a.length-g]:a[g-1];if(!o.i&&e[d]===E||o.i&&e[d].toLowerCase()===E.toLowerCase()){if(v||(v=!0),h||(h=!0),g===a.length){if(y=!0,m!==o.maxMismatches)return!1}else g===1&&(T=!0);if(g-=1,n++,w())return!1;if(!g)return n!==a.length||m===o.maxMismatches||!c?d:!1}else if(!c&&!n&&(c=!0),o.maxMismatches&&m&&d){m-=1;for(let S=0;S<=m;S++){let f=b>d?a[a.length-g+1+S]:a[g-2-S],W=e[t(d)];if(f&&(!o.i&&e[d]===f||o.i&&e[d].toLowerCase()===f.toLowerCase())&&(!o.firstMustMatch||g!==a.length)){if(n++,w())return!1;g-=2,v=!0;break}else if(W&&f&&(!o.i&&W===f||o.i&&W.toLowerCase()===f.toLowerCase())&&(!o.firstMustMatch||g!==a.length)){if(!n&&!o.hungry)return!1;g-=1,v=!0;break}else if(f===void 0&&m>=0&&v&&(!o.firstMustMatch||y)&&(!o.lastMustMatch||T))return d}v||(p=d)}else return d===0&&g===1&&!o.lastMustMatch&&h?0:!1;if(p!==!1&&p!==d&&(p=!1),g<1)return d;d=t(d)}if(g>0)return u&&l==="EOL"?!0:o&&o.maxMismatches>=g&&h?p||0:!1}function Be(e,r,a,i,u){var c,p;if(F(u)&&fe(u,"trimBeforeMatching")&&u&&typeof u.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let t=A(A({},ce),u);if(typeof t.trimCharsBeforeMatching=="string"&&(t.trimCharsBeforeMatching=oe(t.trimCharsBeforeMatching)),t.trimCharsBeforeMatching=t.trimCharsBeforeMatching.map(h=>N(h)?h:String(h)),!N(r)||!r.length)return!1;if(!Number.isInteger(a)||a<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof a}, equal to:
11
- ${JSON.stringify(a,null,4)}`);let l,o;if(N(i))l=[i];else if(Array.isArray(i))l=i;else if(!i)l=i;else if(typeof i=="function")l=[],l.push(i);else throw new Error(`string-match-left-right/${e}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof i}, equal to:
12
- ${JSON.stringify(i,null,4)}`);if(u&&!F(u))throw new Error(`string-match-left-right/${e}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof u}", and equal to:
13
- ${JSON.stringify(u,null,4)}`);let g=0,n="";if(t!=null&&t.trimCharsBeforeMatching&&t.trimCharsBeforeMatching.some((h,m)=>h.length>1?(g=m,n=h,!0):!1))throw new Error(`string-match-left-right/${e}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${g} is longer than 1 character, ${n.length} (equals to ${n}). Please split it into separate characters and put into array as separate elements.`);if(!l||!Array.isArray(l)||Array.isArray(l)&&!l.length||Array.isArray(l)&&l.length===1&&N(l[0])&&!l[0].trim()){if(typeof t.cb=="function"){let m,d=a;if((e==="matchLeftIncl"||e==="matchRight")&&(d+=1),e[5]==="L")for(let w=d;w--;){let b=r[w];if((!t.trimBeforeMatching||t.trimBeforeMatching&&b!==void 0&&b.trim())&&(!((c=t.trimCharsBeforeMatching)!=null&&c.length)||b!==void 0&&!t.trimCharsBeforeMatching.includes(b))){m=w;break}}else if(e.startsWith("matchRight"))for(let w=d;w<r.length;w++){let b=r[w];if((!t.trimBeforeMatching||t.trimBeforeMatching&&b.trim())&&(!((p=t.trimCharsBeforeMatching)!=null&&p.length)||!t.trimCharsBeforeMatching.includes(b))){m=w;break}}if(m===void 0)return!1;let v=r[m],y=m+1,T="";return y&&y>0&&(T=r.slice(0,y)),e[5]==="L"||m&&m>0&&(T=r.slice(m)),t.cb(v,T,m)}let h="";throw u||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${e}(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!${h}`)}for(let h=0,m=l.length;h<m;h++){o=typeof l[h]=="function";let d=l[h],v,y,T="",w=a;e==="matchRight"?w+=1:e==="matchLeft"&&(w-=1);let b=Pe(r,w,d,t,o,E=>e[5]==="L"?E-1:E+1);if(b&&o&&typeof d=="function"&&d()==="EOL")return d()&&(!t.cb||t.cb(v,T,y))?d():!1;if(Number.isInteger(b)&&(y=e.startsWith("matchLeft")?b-1:b+1,e[5]==="L"?T=r.slice(0,b):T=r.slice(y)),y<0&&(y=void 0),r[y]&&(v=r[y]),Number.isInteger(b)&&(!t.cb||t.cb(v,T,y)))return d}return!1}function me(e,r,a,i){return Be("matchRightIncl",e,r,a,i)}var de=ie(Q(),1);var ut=(0,de.default)();var I="\xA0";function Je({str:e,idx:r=0,stopAtNewlines:a=!1,stopAtRawNbsp:i=!1}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),!e[r+1]))return null;if(e[r+1]&&(e[r+1].trim()||a&&`
14
- \r`.includes(e[r+1])||i&&e[r+1]===I))return r+1;if(e[r+2]&&(e[r+2].trim()||a&&`
15
- \r`.includes(e[r+2])||i&&e[r+2]===I))return r+2;for(let u=r+1,t=e.length;u<t;u++)if(e[u].trim()||a&&`
16
- \r`.includes(e[u])||i&&e[u]===I)return u;return null}function L(e,r=0){return Je({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ue({str:e,idx:r,stopAtNewlines:a,stopAtRawNbsp:i}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),r<1))return null;if(e[~-r]&&(e[~-r].trim()||a&&`
17
- \r`.includes(e[~-r])||i&&e[~-r]===I))return~-r;if(e[r-2]&&(e[r-2].trim()||a&&`
18
- \r`.includes(e[r-2])||i&&e[r-2]===I))return r-2;for(let u=r;u--;)if(e[u]&&(e[u].trim()||a&&`
19
- \r`.includes(e[u])||i&&e[u]===I))return u;return null}function _(e,r=0){return Ue({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function J(e,r=1){let a="\xA0";function i(t){return Array.from(t).reverse().join("")}function u(t,l,o){let g=o?`
20
- `:"\r",n=o?"\r":`
10
+ "use strict";var stringRemoveWidows=(()=>{var Pe=Object.create;var j=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols,Ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var q=(e,r,a)=>r in e?j(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,A=(e,r)=>{for(var a in r||(r={}))de.call(r,a)&&q(e,a,r[a]);if(me)for(var a of me(r))qe.call(r,a)&&q(e,a,r[a]);return e};var ke=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Qe=(e,r)=>{for(var a in r)j(e,a,{get:r[a],enumerable:!0})},he=(e,r,a,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Je(r))!de.call(e,u)&&u!==a&&j(e,u,{get:()=>r[u],enumerable:!(s=Be(r,u))||s.enumerable});return e};var pe=(e,r,a)=>(a=e!=null?Pe(Ue(e)):{},he(r||!e||!e.__esModule?j(a,"default",{value:e,enumerable:!0}):a,e)),Ge=e=>he(j({},"__esModule",{value:!0}),e);var k=(e,r,a)=>(q(e,typeof r!="symbol"?r+"":r,a),a);var Q=ke((ct,be)=>{"use strict";be.exports=Ke;function M(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Ke(e){if(e=e||{},e.circles)return Ze(e);return e.proto?s:a;function r(u,t){for(var l=Object.keys(u),i=new Array(l.length),g=0;g<l.length;g++){var n=l[g],c=u[n];typeof c!="object"||c===null?i[n]=c:c instanceof Date?i[n]=new Date(c):ArrayBuffer.isView(c)?i[n]=M(c):i[n]=t(c)}return i}function a(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,a);if(u instanceof Map)return new Map(r(Array.from(u),a));if(u instanceof Set)return new Set(r(Array.from(u),a));var t={};for(var l in u)if(Object.hasOwnProperty.call(u,l)!==!1){var i=u[l];typeof i!="object"||i===null?t[l]=i:i instanceof Date?t[l]=new Date(i):i instanceof Map?t[l]=new Map(r(Array.from(i),a)):i instanceof Set?t[l]=new Set(r(Array.from(i),a)):ArrayBuffer.isView(i)?t[l]=M(i):t[l]=a(i)}return t}function s(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,s);if(u instanceof Map)return new Map(r(Array.from(u),s));if(u instanceof Set)return new Set(r(Array.from(u),s));var t={};for(var l in u){var i=u[l];typeof i!="object"||i===null?t[l]=i:i instanceof Date?t[l]=new Date(i):i instanceof Map?t[l]=new Map(r(Array.from(i),s)):i instanceof Set?t[l]=new Set(r(Array.from(i),s)):ArrayBuffer.isView(i)?t[l]=M(i):t[l]=s(i)}return t}}function Ze(e){var r=[],a=[];return e.proto?t:u;function s(l,i){for(var g=Object.keys(l),n=new Array(g.length),c=0;c<g.length;c++){var p=g[c],h=l[p];if(typeof h!="object"||h===null)n[p]=h;else if(h instanceof Date)n[p]=new Date(h);else if(ArrayBuffer.isView(h))n[p]=M(h);else{var m=r.indexOf(h);m!==-1?n[p]=a[m]:n[p]=i(h)}}return n}function u(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return s(l,u);if(l instanceof Map)return new Map(s(Array.from(l),u));if(l instanceof Set)return new Set(s(Array.from(l),u));var i={};r.push(l),a.push(i);for(var g in l)if(Object.hasOwnProperty.call(l,g)!==!1){var n=l[g];if(typeof n!="object"||n===null)i[g]=n;else if(n instanceof Date)i[g]=new Date(n);else if(n instanceof Map)i[g]=new Map(s(Array.from(n),u));else if(n instanceof Set)i[g]=new Set(s(Array.from(n),u));else if(ArrayBuffer.isView(n))i[g]=M(n);else{var c=r.indexOf(n);c!==-1?i[g]=a[c]:i[g]=u(n)}}return r.pop(),a.pop(),i}function t(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return s(l,t);if(l instanceof Map)return new Map(s(Array.from(l),t));if(l instanceof Set)return new Set(s(Array.from(l),t));var i={};r.push(l),a.push(i);for(var g in l){var n=l[g];if(typeof n!="object"||n===null)i[g]=n;else if(n instanceof Date)i[g]=new Date(n);else if(n instanceof Map)i[g]=new Map(s(Array.from(n),t));else if(n instanceof Set)i[g]=new Set(s(Array.from(n),t));else if(ArrayBuffer.isView(n))i[g]=M(n);else{var c=r.indexOf(n);c!==-1?i[g]=a[c]:i[g]=t(n)}}return r.pop(),a.pop(),i}}});var ut={};Qe(ut,{defaults:()=>He,removeWidows:()=>lt,version:()=>at});function $e(e){return typeof e!="string"?e:e.length?[e]:[]}var ye=pe(Q(),1);var mt=(0,ye.default)();var we="\u2013",Ee="\u2014",x="\xA0";function F(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function N(e){return typeof e=="string"}function O(e){return Number.isSafeInteger(e)&&e>=0}function R(e){return e!=null}function Ae(e,r){return F(e)&&N(r)&&r in e}var Te={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},ze=e=>e+1;function Ye(e,r,a,s,u=!1,t=ze){let l=typeof a=="function"?a():a;if(+r<0&&u&&l==="EOL")return l;let i=A(A({},Te),s);if(r>=e.length&&!u)return!1;let g=u?1:a.length,n=0,c=!1,p=!1,h=!1,m=i.maxMismatches,d=r,v=!1,y=!1,T=!1;function w(){return n===1&&m<i.maxMismatches-1}for(;e[d];){let $=t(d);if(i.trimBeforeMatching&&e[d].trim()===""){if(!e[$]&&u&&a==="EOL")return!0;d=t(d);continue}if(i&&!i.i&&i.trimCharsBeforeMatching&&i.trimCharsBeforeMatching.includes(e[d])||i!=null&&i.i&&i.trimCharsBeforeMatching&&i.trimCharsBeforeMatching.map(S=>S.toLowerCase()).includes(e[d].toLowerCase())){if(u&&a==="EOL"&&!e[$])return!0;d=t(d);continue}let E=$>d?a[a.length-g]:a[g-1];if(!i.i&&e[d]===E||i.i&&e[d].toLowerCase()===E.toLowerCase()){if(v||(v=!0),h||(h=!0),g===a.length){if(y=!0,m!==i.maxMismatches)return!1}else g===1&&(T=!0);if(g-=1,n++,w())return!1;if(!g)return n!==a.length||m===i.maxMismatches||!c?d:!1}else if(!c&&!n&&(c=!0),i.maxMismatches&&m&&d){m-=1;for(let S=0;S<=m;S++){let f=$>d?a[a.length-g+1+S]:a[g-2-S],W=e[t(d)];if(f&&(!i.i&&e[d]===f||i.i&&e[d].toLowerCase()===f.toLowerCase())&&(!i.firstMustMatch||g!==a.length)){if(n++,w())return!1;g-=2,v=!0;break}else if(W&&f&&(!i.i&&W===f||i.i&&W.toLowerCase()===f.toLowerCase())&&(!i.firstMustMatch||g!==a.length)){if(!n&&!i.hungry)return!1;g-=1,v=!0;break}else if(f===void 0&&m>=0&&v&&(!i.firstMustMatch||y)&&(!i.lastMustMatch||T))return d}v||(p=d)}else return d===0&&g===1&&!i.lastMustMatch&&h?0:!1;if(p!==!1&&p!==d&&(p=!1),g<1)return d;d=t(d)}if(g>0)return u&&l==="EOL"?!0:i&&i.maxMismatches>=g&&h?p||0:!1}function Xe(e,r,a,s,u){var c,p;if(F(u)&&Ae(u,"trimBeforeMatching")&&u&&typeof u.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let t=A(A({},Te),u);if(typeof t.trimCharsBeforeMatching=="string"&&(t.trimCharsBeforeMatching=$e(t.trimCharsBeforeMatching)),t.trimCharsBeforeMatching=t.trimCharsBeforeMatching.map(h=>N(h)?h:String(h)),!N(r)||!r.length)return!1;if(!Number.isInteger(a)||a<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof a}, equal to:
11
+ ${JSON.stringify(a,null,4)}`);let l,i;if(N(s))l=[s];else if(Array.isArray(s))l=s;else if(!s)l=s;else if(typeof s=="function")l=[],l.push(s);else throw new Error(`string-match-left-right/${e}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof s}, equal to:
12
+ ${JSON.stringify(s,null,4)}`);if(u&&!F(u))throw new Error(`string-match-left-right/${e}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof u}", and equal to:
13
+ ${JSON.stringify(u,null,4)}`);let g=0,n="";if(t!=null&&t.trimCharsBeforeMatching&&t.trimCharsBeforeMatching.some((h,m)=>h.length>1?(g=m,n=h,!0):!1))throw new Error(`string-match-left-right/${e}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${g} is longer than 1 character, ${n.length} (equals to ${n}). Please split it into separate characters and put into array as separate elements.`);if(!l||!Array.isArray(l)||Array.isArray(l)&&!l.length||Array.isArray(l)&&l.length===1&&N(l[0])&&!l[0].trim()){if(typeof t.cb=="function"){let m,d=a;if((e==="matchLeftIncl"||e==="matchRight")&&(d+=1),e[5]==="L")for(let w=d;w--;){let $=r[w];if((!t.trimBeforeMatching||t.trimBeforeMatching&&($!=null&&$.trim()))&&(!((c=t.trimCharsBeforeMatching)!=null&&c.length)||$!==void 0&&!t.trimCharsBeforeMatching.includes($))){m=w;break}}else if(e.startsWith("matchRight"))for(let w=d;w<r.length;w++){let $=r[w];if((!t.trimBeforeMatching||t.trimBeforeMatching&&$.trim())&&(!((p=t.trimCharsBeforeMatching)!=null&&p.length)||!t.trimCharsBeforeMatching.includes($))){m=w;break}}if(m===void 0)return!1;let v=r[m],y=m+1,T="";return y&&y>0&&(T=r.slice(0,y)),e[5]==="L"||m&&m>0&&(T=r.slice(m)),t.cb(v,T,m)}let h="";throw u||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${e}(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!${h}`)}for(let h=0,m=l.length;h<m;h++){i=typeof l[h]=="function";let d=l[h],v,y,T="",w=a;e==="matchRight"?w+=1:e==="matchLeft"&&(w-=1);let $=Ye(r,w,d,t,i,E=>e[5]==="L"?E-1:E+1);if($&&i&&typeof d=="function"&&d()==="EOL")return d()&&(!t.cb||t.cb(v,T,y))?d():!1;if(Number.isInteger($)&&(y=e.startsWith("matchLeft")?$-1:$+1,e[5]==="L"?T=r.slice(0,$):T=r.slice(y)),y<0&&(y=void 0),r[y]&&(v=r[y]),Number.isInteger($)&&(!t.cb||t.cb(v,T,y)))return d}return!1}function ve(e,r,a,s){return Xe("matchRightIncl",e,r,a,s)}var Se=pe(Q(),1);var wt=(0,Se.default)();var I="\xA0";function et({str:e,idx:r=0,stopAtNewlines:a=!1,stopAtRawNbsp:s=!1}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),!e[r+1]))return null;if(e[r+1]&&(e[r+1].trim()||a&&`
14
+ \r`.includes(e[r+1])||s&&e[r+1]===I))return r+1;if(e[r+2]&&(e[r+2].trim()||a&&`
15
+ \r`.includes(e[r+2])||s&&e[r+2]===I))return r+2;for(let u=r+1,t=e.length;u<t;u++)if(e[u].trim()||a&&`
16
+ \r`.includes(e[u])||s&&e[u]===I)return u;return null}function L(e,r=0){return et({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function tt({str:e,idx:r,stopAtNewlines:a,stopAtRawNbsp:s}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),r<1))return null;if(e[~-r]&&(e[~-r].trim()||a&&`
17
+ \r`.includes(e[~-r])||s&&e[~-r]===I))return~-r;if(e[r-2]&&(e[r-2].trim()||a&&`
18
+ \r`.includes(e[r-2])||s&&e[r-2]===I))return r-2;for(let u=r;u--;)if(e[u]&&(e[u].trim()||a&&`
19
+ \r`.includes(e[u])||s&&e[u]===I))return u;return null}function _(e,r=0){return tt({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function J(e,r=1){let a="\xA0";function s(t){return Array.from(t).reverse().join("")}function u(t,l,i){let g=i?`
20
+ `:"\r",n=i?"\r":`
21
21
  `;if(!t)return t;let c=0,p=0,h="";for(let m=0,d=t.length;m<d;m++)(t[m]===g||t[m]===n&&t[m-1]!==g)&&p++,`\r
22
- `.includes(t[m])||t[m]===a?(c=0,t[m]===a?h+=t[m]:t[m]===g?p<=l&&(h+=t[m],t[m+1]===n&&(h+=t[m+1],m++)):t[m]===n&&(t==null?void 0:t[m-1])!==g&&p<=l&&(h+=t[m])):(c++,!t[m+1]&&!p&&(h+=" "));return h}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let l="",o="";if(!e.trim())l=e;else if(!e[0].trim()){for(let g=0,n=e.length;g<n;g++)if(e[g].trim()){l=e.slice(0,g);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===a)){for(let g=e.length;g--;)if(e[g].trim()){o=e.slice(g+1);break}}return`${u(l,t,!1)}${e.trim()}${i(u(i(o),t,!0))}`}return e}var qe={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function V(e,r){if(!Array.isArray(e)||!e.length)return e;let a=A(A({},qe),r),i,u;if(a.strictlyTwoElementsInRangeArrays&&!e.every((o,g)=>!Array.isArray(o)||o.length!==2?(i=g,u=o.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${i}th range (${JSON.stringify(e[i],null,4)}) has not two but ${u} elements!`);if(!e.every((o,g)=>!Array.isArray(o)||!Number.isInteger(o[0])||o[0]<0||!Number.isInteger(o[1])||o[1]<0?(i=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${i}th range (${JSON.stringify(e[i],null,4)}) does not consist of only natural numbers!`);let t=e.length**2,l=0;return Array.from(e).sort((o,g)=>(a.progressFn&&(l+=1,a.progressFn(Math.floor(l*100/t))),o[0]===g[0]?o[1]<g[1]?-1:o[1]>g[1]?1:0:o[0]<g[0]?-1:1))}var he={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ke(e,r){function a(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;let i;if(r)if(a(r)){if(i=A(A({},he),r),i.progressFn&&a(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof i.progressFn}", equal to ${JSON.stringify(i.progressFn,null,4)}`);if(![1,2,"1","2"].includes(i.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof i.mergeType}", equal to ${JSON.stringify(i.mergeType,null,4)}`);if(typeof i.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof i.joinRangesThatTouchEdges}", equal to ${JSON.stringify(i.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
23
- ${JSON.stringify(r,null,4)} (type ${typeof r})`);else i=A({},he);let u=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),t,l,o;i.progressFn?t=V(u,{progressFn:n=>{o=Math.floor(n/5),o!==l&&(l=o,i.progressFn(o))}}):t=V(u);let g=t.length-1;for(let n=g;n>0;n--)i.progressFn&&(o=Math.floor((1-n/g)*78)+21,o!==l&&o>l&&(l=o,i.progressFn(o))),(t[n][0]<=t[n-1][0]||!i.joinRangesThatTouchEdges&&t[n][0]<t[n-1][1]||i.joinRangesThatTouchEdges&&t[n][0]<=t[n-1][1])&&(t[n-1][0]=Math.min(t[n][0],t[n-1][0]),t[n-1][1]=Math.max(t[n][1],t[n-1][1]),t[n][2]!==void 0&&(t[n-1][0]>=t[n][0]||t[n-1][1]<=t[n][1])&&t[n-1][2]!==null&&(t[n][2]===null&&t[n-1][2]!==null?t[n-1][2]=null:t[n-1][2]!=null?+i.mergeType==2&&t[n-1][0]===t[n][0]?t[n-1][2]=t[n][2]:t[n-1][2]+=t[n][2]:t[n-1][2]=t[n][2]),t.splice(n,1),n=t.length);return t.length?t:null}var Qe={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},pe=class{constructor(e){k(this,"ranges");k(this,"opts");let r=A(A({},Qe),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(N(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(N(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType,null,4)}`);this.opts=r,this.ranges=[]}add(e,r,a){var t;if(e==null&&r==null)return;if(R(e)&&!R(r)){if(Array.isArray(e)){if(e.length){if(e.some(l=>Array.isArray(l))){e.forEach(l=>{Array.isArray(l)&&this.add(...l)});return}e.length&&O(+e[0])&&O(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(r,null,0)})`)}else if(!R(e)&&R(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(r,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let i=+e,u=+r;if(O(a)&&(a=String(a)),O(i)&&O(u)){if(R(a)&&!N(a)&&!O(a))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof a}, equal to:
24
- ${JSON.stringify(a,null,4)}`);if(R(this.ranges)&&Array.isArray(this.last())&&i===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&R(a)){let l=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${a}`:a;this.opts.limitToBeAddedWhitespace&&(l=J(l,this.opts.limitLinebreaksCount)),N(l)&&!l.length||(this.last()[2]=l)}}else{this.ranges||(this.ranges=[]);let l=a!==void 0&&!(N(a)&&!a.length)?[i,u,a&&this.opts.limitToBeAddedWhitespace?J(a,this.opts.limitLinebreaksCount):a]:[i,u];this.ranges.push(l)}}else throw O(i)&&i>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof u}" equal to: ${JSON.stringify(u,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof i}" equal to: ${JSON.stringify(i,null,4)}`)}push(e,r,a){this.add(e,r,a)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=ke(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>R(e[2])?[e[0],e[1],J(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&O(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var $e={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function be(e,r){function a(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;let i;if(r)if(a(r)){if(i=A(A({},$e),r),i.progressFn&&a(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof i.progressFn}", equal to ${JSON.stringify(i.progressFn,null,4)}`);if(![1,2,"1","2"].includes(i.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof i.mergeType}", equal to ${JSON.stringify(i.mergeType,null,4)}`);if(typeof i.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof i.joinRangesThatTouchEdges}", equal to ${JSON.stringify(i.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
25
- ${JSON.stringify(r,null,4)} (type ${typeof r})`);else i=A({},$e);let u=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),t,l,o;i.progressFn?t=V(u,{progressFn:n=>{o=Math.floor(n/5),o!==l&&(l=o,i.progressFn(o))}}):t=V(u);let g=t.length-1;for(let n=g;n>0;n--)i.progressFn&&(o=Math.floor((1-n/g)*78)+21,o!==l&&o>l&&(l=o,i.progressFn(o))),(t[n][0]<=t[n-1][0]||!i.joinRangesThatTouchEdges&&t[n][0]<t[n-1][1]||i.joinRangesThatTouchEdges&&t[n][0]<=t[n-1][1])&&(t[n-1][0]=Math.min(t[n][0],t[n-1][0]),t[n-1][1]=Math.max(t[n][1],t[n-1][1]),t[n][2]!==void 0&&(t[n-1][0]>=t[n][0]||t[n-1][1]<=t[n][1])&&t[n-1][2]!==null&&(t[n][2]===null&&t[n-1][2]!==null?t[n-1][2]=null:t[n-1][2]!=null?+i.mergeType==2&&t[n-1][0]===t[n][0]?t[n-1][2]=t[n][2]:t[n-1][2]+=t[n][2]:t[n-1][2]=t[n][2]),t.splice(n,1),n=t.length);return t.length?t:null}var Ge=!0,G="Invariant failed";function ye(e,r){if(!e){if(Ge)throw new Error(G);var a=typeof r=="function"?r():r,i=a?"".concat(G,": ").concat(a):G;throw new Error(i)}}function K(e,r,a){let i=0,u=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(a&&typeof a!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof a}, equal to: ${JSON.stringify(a,null,4)}`);if(!(r!=null&&r.filter(c=>c).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let l=t.length,o=0;t.filter(c=>c).forEach((c,p)=>{if(a&&(i=Math.floor(o/l*10),i!==u&&(u=i,a(i))),!Array.isArray(c))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}th element not an array: ${JSON.stringify(c,null,4)}, which is ${typeof c}`);if(!Number.isInteger(c[0])){if(!Number.isInteger(+c[0])||+c[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(c,null,0)}. Its first element is not an integer, string index, but ${typeof c[0]}, equal to: ${JSON.stringify(c[0],null,4)}.`);t[p][0]=+t[p][0]}if(!Number.isInteger(c[1])){if(!Number.isInteger(+c[1])||+c[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(c,null,0)}. Its second element is not an integer, string index, but ${typeof c[1]}, equal to: ${JSON.stringify(c[1],null,4)}.`);t[p][1]=+t[p][1]}o+=1});let g=be(t,{progressFn:c=>{a&&(i=10+Math.floor(c/10),i!==u&&(u=i,a(i)))}});ye(g);let n=g.length;if(n>0){let c=e.slice(g[n-1][1]);e=g.reduce((p,h,m,d)=>{a&&(i=20+Math.floor(m/n*80),i!==u&&(u=i,a(i)));let v=m===0?0:d[m-1][1],y=d[m][0];return`${p}${e.slice(v,y)}${d[m][2]||""}`},""),e+=c}return e}var we="4.0.15";var H="&nbsp;",P="\\00A0",B="\\u00A0",Ee="&ndash;",Ae="\\2013",Te="\\u2013",ve="&mdash;",Se="\\2014",De="\\u2014",Z=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Ne=[{heads:"{{",tails:"}}"}],z=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],We=["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 Ze=we,Ce={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function ze(e,r){let a=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
26
- ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof r}, equal to ${JSON.stringify(r,null,4)}`);let i=Array.isArray,u=e.length,t=new pe({mergeType:2}),l=["."],o=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,g=/^[0-9][A-Z]{2}/,n=.06,c,p=0,h=0,m=0,d,v,y,T,w,b,E,S,f=A(A({},Ce),r),W={removeWidows:!1,convertEntities:!1};if(!f.ignore||!i(f.ignore)&&typeof f.ignore!="string")f.ignore=[];else if(typeof f.ignore=="string"&&(f.ignore=[f.ignore]),f.ignore.includes("all"))f.ignore=f.ignore.concat(Z.concat(z));else if(f.ignore.some(s=>typeof s=="string")){let s=[];f.ignore=f.ignore.filter(D=>typeof D=="string"&&D.length?(["nunjucks","jinja","liquid"].includes(D.trim().toLowerCase())?s=s.concat(Z):["hugo"].includes(D.trim().toLowerCase())?s=s.concat(Ne):["hexo"].includes(D.trim().toLowerCase())&&(s=s.concat(z)),!1):typeof D=="object"),s.length&&(f.ignore=f.ignore.concat(s))}let Y;f.reportProgressFunc&&(Y=Math.floor(f.reportProgressFuncTo-(f.reportProgressFuncTo-f.reportProgressFuncFrom)*n-f.reportProgressFuncFrom));function U(s,D){let $=x;f.removeWidowPreventionMeasures?$=" ":f.convertEntities&&($=H,typeof f.targetLanguage=="string"&&(f.targetLanguage.trim().toLowerCase()==="css"?$=P:f.targetLanguage.trim().toLowerCase()==="js"&&($=B))),e.slice(s,D)!==$&&t.push(s,D,$)}function X(){h=0,m=0,d=void 0,v=void 0,y=void 0,T=void 0,w=void 0,b=void 0}X();for(let s=0;s<=u;s++){if(!E&&i(f.ignore)&&f.ignore.length&&f.ignore.some(($,C)=>{if(i($.heads)&&$.heads.some(ee=>e.startsWith(ee,s))||typeof $.heads=="string"&&e.startsWith($.heads,s))return h+=1,E=f.ignore[C].tails,!0}),!E&&S&&S===s&&(h+=1,S=void 0),typeof f.reportProgressFunc=="function"&&(c=f.reportProgressFuncFrom+Math.floor(s/u*(Y||1)),c!==p&&(p=c,f.reportProgressFunc(c))),!E&&s&&e[s]&&e[s].trim()&&(!e[s-1]||e[s-1]&&!e[s-1].trim())&&(T=s),!E&&e[s]&&e[s].trim()&&(m+=1),!E&&f.hyphens&&(`-${ge}${ue}`.includes(e[s])||e.startsWith(Ee,s)||e.startsWith(Ae,s)||e.startsWith(Te,s)||e.startsWith(ve,s)||e.startsWith(Se,s)||e.startsWith(De,s))&&e[s+1]&&(!e[s+1].trim()||e[s]==="&")&&e[s-1]&&!e[s-1].trim()&&e[_(e,s)]&&(U(_(e,s)+1,s),W.removeWidows=!0),!E&&(e.startsWith("&nbsp;",s)||e.startsWith("&#160;",s))&&(w=s,b=s+6,e[s+6]&&e[s+6].trim()&&(S=s+6),f.convertEntities?(f.targetLanguage==="css"||f.targetLanguage==="js")&&(t.push(s,s+6,f.targetLanguage==="css"?P:B),W.convertEntities=!0):(t.push(s,s+6,x),W.convertEntities=!0)),!E&&e[s+4]&&e[s]==="\\"&&e[s+1]==="0"&&e[s+2]==="0"&&e[s+3].toUpperCase()==="A"&&e[s+4]==="0"&&(w=s,b=s+5,e[s+5]&&e[s+5].trim()&&(S=s+5),f.convertEntities?(f.targetLanguage==="html"||f.targetLanguage==="js")&&(t.push(s,s+5,f.targetLanguage==="html"?H:B),W.convertEntities=!0):(t.push(s,s+5,x),W.convertEntities=!0)),!E&&e[s]==="\\"&&e[s+1]&&e[s+1].toLowerCase()==="u"&&e[s+2]==="0"&&e[s+3]==="0"&&e[s+4]&&e[s+4].toUpperCase()==="A"&&e[s+5]==="0"&&(w=s,b=s+6,e[s+6]&&e[s+6].trim()&&(S=s+6),f.convertEntities?(f.targetLanguage==="html"||f.targetLanguage==="css")&&t.push(s,s+6,f.targetLanguage==="html"?H:P):t.push(s,s+6,x)),!E&&e[s]===x&&(w=s,b=s+1,f.convertEntities&&t.push(s,s+1,f.targetLanguage==="css"?P:f.targetLanguage==="js"?B:H)),!E&&e[s]&&e[s].trim()&&(!e[s-1]||!e[s-1].trim())&&(h+=1),!E&&(!e[s]||`\r
27
- `.includes(e[s])||(e[s]===`
28
- `||e[s]==="\r"||e[s]==="\r"&&e[s+1]===`
29
- `)&&_(e,s)&&l.includes(e[_(e,s)]))){if((!f.minWordCount||h>=f.minWordCount)&&(!f.minCharCount||m>=f.minCharCount)){let $,C;y!==void 0&&T!==void 0&&w!==void 0&&b!==void 0?y>w?($=y,C=T):($=w,C=b):y!==void 0&&T!==void 0?($=y,C=T):w!==void 0&&b!==void 0&&($=w,C=b),!($&&C)&&d&&v&&($=d,C=v),$&&C&&(U($,C),W.removeWidows=!0)}X()}f.UKPostcodes&&e[s]&&!e[s].trim()&&e[s-1]&&e[s-1].trim()&&o.test(e.slice(0,s))&&e[L(e,s)]&&g.test(e.slice(L(e,s)))&&(U(s,L(e,s)),W.removeWidows=!0),!E&&e[s]&&!e[s].trim()&&e[s-1]&&e[s-1].trim()&&(y===void 0||e[y-1]&&e[y-1].trim())&&!"/>".includes(e[L(e,s)])&&!e.slice(0,s).trim().endsWith("br")&&!e.slice(0,s).trim().endsWith("hr")&&!(e.slice(0,s).endsWith("<")&&We.some($=>e.startsWith($,L(e,s))))&&(d=y,v=T,y=s,T=void 0,(w!==void 0||b!==void 0)&&(w=void 0,b=void 0));let D;E&&(typeof E=="string"&&(!E.length||e.startsWith(E,s))?E=void 0:i(E)&&(!E.length||E.some($=>{if(e.startsWith($,s))return D=$,!0}))&&(E=void 0,s+=D.length,i(f.ignore)&&f.ignore.length&&e[s+1]&&f.ignore.some($=>me(e,s,$.tails,{trimBeforeMatching:!0,cb:(C,ee,te)=>(te&&(s=te-1,e[s+1]&&e[s+1].trim()&&(h+=1)),!0)})))),e[s]&&`\r
30
- `.includes(e[s])&&(h=0,m=0),i(f.tagRanges)&&f.tagRanges.length&&f.tagRanges.some($=>{if(s>=$[0]&&s<=$[1]&&$[1]-1>s)return s=$[1]-1,!0})}return K(e,t.current()).split("").forEach((s,D)=>{}),{res:K(e,t.current(),f.reportProgressFunc?s=>{c=Math.floor((f.reportProgressFuncTo-f.reportProgressFuncFrom)*(1-n)+s/100*(f.reportProgressFuncTo-f.reportProgressFuncFrom)*n),c!==p&&(p=c,f.reportProgressFunc(c))}:void 0),ranges:t.current(),log:{timeTakenInMilliseconds:Date.now()-a},whatWasDone:W}}return je(Ye);})();
22
+ `.includes(t[m])||t[m]===a?(c=0,t[m]===a?h+=t[m]:t[m]===g?p<=l&&(h+=t[m],t[m+1]===n&&(h+=t[m+1],m++)):t[m]===n&&(t==null?void 0:t[m-1])!==g&&p<=l&&(h+=t[m])):(c++,!t[m+1]&&!p&&(h+=" "));return h}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let l="",i="";if(!e.trim())l=e;else if(!e[0].trim()){for(let g=0,n=e.length;g<n;g++)if(e[g].trim()){l=e.slice(0,g);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===a)){for(let g=e.length;g--;)if(e[g].trim()){i=e.slice(g+1);break}}return`${u(l,t,!1)}${e.trim()}${s(u(s(i),t,!0))}`}return e}var rt={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function V(e,r){if(!Array.isArray(e)||!e.length)return e;let a=A(A({},rt),r),s,u;if(a.strictlyTwoElementsInRangeArrays&&!e.every((i,g)=>!Array.isArray(i)||i.length!==2?(s=g,u=i.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) has not two but ${u} elements!`);if(!e.every((i,g)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(s=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) does not consist of only natural numbers!`);let t=e.length**2,l=0;return Array.from(e).sort((i,g)=>(a.progressFn&&(l+=1,a.progressFn(Math.floor(l*100/t))),i[0]===g[0]?i[1]<g[1]?-1:i[1]>g[1]?1:0:i[0]<g[0]?-1:1))}var De={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function nt(e,r){function a(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(a(r)){if(s=A(A({},De),r),s.progressFn&&a(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
23
+ ${JSON.stringify(r,null,4)} (type ${typeof r})`);else s=A({},De);let u=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),t,l,i;s.progressFn?t=V(u,{progressFn:n=>{i=Math.floor(n/5),i!==l&&(l=i,s.progressFn(i))}}):t=V(u);let g=t.length-1;for(let n=g;n>0;n--)s.progressFn&&(i=Math.floor((1-n/g)*78)+21,i!==l&&i>l&&(l=i,s.progressFn(i))),(t[n][0]<=t[n-1][0]||!s.joinRangesThatTouchEdges&&t[n][0]<t[n-1][1]||s.joinRangesThatTouchEdges&&t[n][0]<=t[n-1][1])&&(t[n-1][0]=Math.min(t[n][0],t[n-1][0]),t[n-1][1]=Math.max(t[n][1],t[n-1][1]),t[n][2]!==void 0&&(t[n-1][0]>=t[n][0]||t[n-1][1]<=t[n][1])&&t[n-1][2]!==null&&(t[n][2]===null&&t[n-1][2]!==null?t[n-1][2]=null:t[n-1][2]!=null?+s.mergeType==2&&t[n-1][0]===t[n][0]?t[n-1][2]=t[n][2]:t[n-1][2]+=t[n][2]:t[n-1][2]=t[n][2]),t.splice(n,1),n=t.length);return t.length?t:null}var st={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Ne=class{constructor(e){k(this,"ranges");k(this,"opts");let r=A(A({},st),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(N(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(N(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType,null,4)}`);this.opts=r,this.ranges=[]}add(e,r,a){var t;if(e==null&&r==null)return;if(R(e)&&!R(r)){if(Array.isArray(e)){if(e.length){if(e.some(l=>Array.isArray(l))){e.forEach(l=>{Array.isArray(l)&&this.add(...l)});return}e.length&&O(+e[0])&&O(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(r,null,0)})`)}else if(!R(e)&&R(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(r,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let s=+e,u=+r;if(O(a)&&(a=String(a)),O(s)&&O(u)){if(R(a)&&!N(a)&&!O(a))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof a}, equal to:
24
+ ${JSON.stringify(a,null,4)}`);if(R(this.ranges)&&Array.isArray(this.last())&&s===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&R(a)){let l=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${a}`:a;this.opts.limitToBeAddedWhitespace&&(l=J(l,this.opts.limitLinebreaksCount)),N(l)&&!l.length||(this.last()[2]=l)}}else{this.ranges||(this.ranges=[]);let l=a!==void 0&&!(N(a)&&!a.length)?[s,u,a&&this.opts.limitToBeAddedWhitespace?J(a,this.opts.limitLinebreaksCount):a]:[s,u];this.ranges.push(l)}}else throw O(s)&&s>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof u}" equal to: ${JSON.stringify(u,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof s}" equal to: ${JSON.stringify(s,null,4)}`)}push(e,r,a){this.add(e,r,a)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=nt(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>R(e[2])?[e[0],e[1],J(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&O(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var We={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ce(e,r){function a(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(a(r)){if(s=A(A({},We),r),s.progressFn&&a(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
25
+ ${JSON.stringify(r,null,4)} (type ${typeof r})`);else s=A({},We);let u=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),t,l,i;s.progressFn?t=V(u,{progressFn:n=>{i=Math.floor(n/5),i!==l&&(l=i,s.progressFn(i))}}):t=V(u);let g=t.length-1;for(let n=g;n>0;n--)s.progressFn&&(i=Math.floor((1-n/g)*78)+21,i!==l&&i>l&&(l=i,s.progressFn(i))),(t[n][0]<=t[n-1][0]||!s.joinRangesThatTouchEdges&&t[n][0]<t[n-1][1]||s.joinRangesThatTouchEdges&&t[n][0]<=t[n-1][1])&&(t[n-1][0]=Math.min(t[n][0],t[n-1][0]),t[n-1][1]=Math.max(t[n][1],t[n-1][1]),t[n][2]!==void 0&&(t[n-1][0]>=t[n][0]||t[n-1][1]<=t[n][1])&&t[n-1][2]!==null&&(t[n][2]===null&&t[n-1][2]!==null?t[n-1][2]=null:t[n-1][2]!=null?+s.mergeType==2&&t[n-1][0]===t[n][0]?t[n-1][2]=t[n][2]:t[n-1][2]+=t[n][2]:t[n-1][2]=t[n][2]),t.splice(n,1),n=t.length);return t.length?t:null}var it=!0,G="Invariant failed";function Oe(e,r){if(!e){if(it)throw new Error(G);var a=typeof r=="function"?r():r,s=a?"".concat(G,": ").concat(a):G;throw new Error(s)}}function K(e,r,a){let s=0,u=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(a&&typeof a!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof a}, equal to: ${JSON.stringify(a,null,4)}`);if(!(r!=null&&r.filter(c=>c).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let l=t.length,i=0;t.filter(c=>c).forEach((c,p)=>{if(a&&(s=Math.floor(i/l*10),s!==u&&(u=s,a(s))),!Array.isArray(c))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}th element not an array: ${JSON.stringify(c,null,4)}, which is ${typeof c}`);if(!Number.isInteger(c[0])){if(!Number.isInteger(+c[0])||+c[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(c,null,0)}. Its first element is not an integer, string index, but ${typeof c[0]}, equal to: ${JSON.stringify(c[0],null,4)}.`);t[p][0]=+t[p][0]}if(!Number.isInteger(c[1])){if(!Number.isInteger(+c[1])||+c[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(c,null,0)}. Its second element is not an integer, string index, but ${typeof c[1]}, equal to: ${JSON.stringify(c[1],null,4)}.`);t[p][1]=+t[p][1]}i+=1});let g=Ce(t,{progressFn:c=>{a&&(s=10+Math.floor(c/10),s!==u&&(u=s,a(s)))}});Oe(g);let n=g.length;if(n>0){let c=e.slice(g[n-1][1]);e=g.reduce((p,h,m,d)=>{a&&(s=20+Math.floor(m/n*80),s!==u&&(u=s,a(s)));let v=m===0?0:d[m-1][1],y=d[m][0];return`${p}${e.slice(v,y)}${d[m][2]||""}`},""),e+=c}return e}var Re="4.0.16";var H="&nbsp;",P="\\00A0",B="\\u00A0",Me="&ndash;",xe="\\2013",Ie="\\u2013",Le="&mdash;",Ve="\\2014",je="\\u2014",Z=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Fe=[{heads:"{{",tails:"}}"}],z=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],_e=["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 at=Re,He={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function lt(e,r){var ee,te,re,ne,se,ie,oe,ae,le,ue;let a=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
26
+ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof r}, equal to ${JSON.stringify(r,null,4)}`);let s=Array.isArray,u=e.length,t=new Ne({mergeType:2}),l=["."],i=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,g=/^[0-9][A-Z]{2}/,n=.06,c,p=0,h=0,m=0,d,v,y,T,w,$,E,S,f=A(A({},He),r),W={removeWidows:!1,convertEntities:!1};if(!f.ignore||!s(f.ignore)&&typeof f.ignore!="string")f.ignore=[];else if(typeof f.ignore=="string"&&(f.ignore=[f.ignore]),f.ignore.includes("all"))f.ignore=f.ignore.concat(Z.concat(z));else if(f.ignore.some(o=>typeof o=="string")){let o=[];f.ignore=f.ignore.filter(D=>typeof D=="string"&&D.length?(["nunjucks","jinja","liquid"].includes(D.trim().toLowerCase())?o=o.concat(Z):["hugo"].includes(D.trim().toLowerCase())?o=o.concat(Fe):["hexo"].includes(D.trim().toLowerCase())&&(o=o.concat(z)),!1):typeof D=="object"),o.length&&(f.ignore=f.ignore.concat(o))}let Y;f.reportProgressFunc&&(Y=Math.floor(f.reportProgressFuncTo-(f.reportProgressFuncTo-f.reportProgressFuncFrom)*n-f.reportProgressFuncFrom));function U(o,D){let b=x;f.removeWidowPreventionMeasures?b=" ":f.convertEntities&&(b=H,typeof f.targetLanguage=="string"&&(f.targetLanguage.trim().toLowerCase()==="css"?b=P:f.targetLanguage.trim().toLowerCase()==="js"&&(b=B))),e.slice(o,D)!==b&&t.push(o,D,b)}function X(){h=0,m=0,d=void 0,v=void 0,y=void 0,T=void 0,w=void 0,$=void 0}X();for(let o=0;o<=u;o++){if(!E&&s(f.ignore)&&f.ignore.length&&f.ignore.some((b,C)=>{if(s(b.heads)&&b.heads.some(ge=>e.startsWith(ge,o))||typeof b.heads=="string"&&e.startsWith(b.heads,o))return h+=1,E=f.ignore[C].tails,!0}),!E&&S&&S===o&&(h+=1,S=void 0),typeof f.reportProgressFunc=="function"&&(c=f.reportProgressFuncFrom+Math.floor(o/u*(Y||1)),c!==p&&(p=c,f.reportProgressFunc(c))),!E&&o&&((ee=e[o])!=null&&ee.trim())&&(!e[o-1]||e[o-1]&&!e[o-1].trim())&&(T=o),!E&&((te=e[o])!=null&&te.trim())&&(m+=1),!E&&f.hyphens&&(`-${Ee}${we}`.includes(e[o])||e.startsWith(Me,o)||e.startsWith(xe,o)||e.startsWith(Ie,o)||e.startsWith(Le,o)||e.startsWith(Ve,o)||e.startsWith(je,o))&&e[o+1]&&(!e[o+1].trim()||e[o]==="&")&&e[o-1]&&!e[o-1].trim()&&e[_(e,o)]&&(U(_(e,o)+1,o),W.removeWidows=!0),!E&&(e.startsWith("&nbsp;",o)||e.startsWith("&#160;",o))&&(w=o,$=o+6,(re=e[o+6])!=null&&re.trim()&&(S=o+6),f.convertEntities?(f.targetLanguage==="css"||f.targetLanguage==="js")&&(t.push(o,o+6,f.targetLanguage==="css"?P:B),W.convertEntities=!0):(t.push(o,o+6,x),W.convertEntities=!0)),!E&&e[o+4]&&e[o]==="\\"&&e[o+1]==="0"&&e[o+2]==="0"&&e[o+3].toUpperCase()==="A"&&e[o+4]==="0"&&(w=o,$=o+5,(ne=e[o+5])!=null&&ne.trim()&&(S=o+5),f.convertEntities?(f.targetLanguage==="html"||f.targetLanguage==="js")&&(t.push(o,o+5,f.targetLanguage==="html"?H:B),W.convertEntities=!0):(t.push(o,o+5,x),W.convertEntities=!0)),!E&&e[o]==="\\"&&e[o+1]&&e[o+1].toLowerCase()==="u"&&e[o+2]==="0"&&e[o+3]==="0"&&e[o+4]&&e[o+4].toUpperCase()==="A"&&e[o+5]==="0"&&(w=o,$=o+6,(se=e[o+6])!=null&&se.trim()&&(S=o+6),f.convertEntities?(f.targetLanguage==="html"||f.targetLanguage==="css")&&t.push(o,o+6,f.targetLanguage==="html"?H:P):t.push(o,o+6,x)),!E&&e[o]===x&&(w=o,$=o+1,f.convertEntities&&t.push(o,o+1,f.targetLanguage==="css"?P:f.targetLanguage==="js"?B:H)),!E&&((ie=e[o])!=null&&ie.trim())&&!((oe=e[o-1])!=null&&oe.trim())&&(h+=1),!E&&(!e[o]||`\r
27
+ `.includes(e[o])||(e[o]===`
28
+ `||e[o]==="\r"||e[o]==="\r"&&e[o+1]===`
29
+ `)&&_(e,o)&&l.includes(e[_(e,o)]))){if((!f.minWordCount||h>=f.minWordCount)&&(!f.minCharCount||m>=f.minCharCount)){let b,C;y!==void 0&&T!==void 0&&w!==void 0&&$!==void 0?y>w?(b=y,C=T):(b=w,C=$):y!==void 0&&T!==void 0?(b=y,C=T):w!==void 0&&$!==void 0&&(b=w,C=$),!(b&&C)&&d&&v&&(b=d,C=v),b&&C&&(U(b,C),W.removeWidows=!0)}X()}f.UKPostcodes&&e[o]&&!e[o].trim()&&((ae=e[o-1])!=null&&ae.trim())&&i.test(e.slice(0,o))&&e[L(e,o)]&&g.test(e.slice(L(e,o)))&&(U(o,L(e,o)),W.removeWidows=!0),!E&&e[o]&&!e[o].trim()&&((le=e[o-1])!=null&&le.trim())&&(y===void 0||(ue=e[y-1])!=null&&ue.trim())&&!"/>".includes(e[L(e,o)])&&!e.slice(0,o).trim().endsWith("br")&&!e.slice(0,o).trim().endsWith("hr")&&!(e.slice(0,o).endsWith("<")&&_e.some(b=>e.startsWith(b,L(e,o))))&&(d=y,v=T,y=o,T=void 0,(w!==void 0||$!==void 0)&&(w=void 0,$=void 0));let D;E&&(typeof E=="string"&&(!E.length||e.startsWith(E,o))?E=void 0:s(E)&&(!E.length||E.some(b=>{if(e.startsWith(b,o))return D=b,!0}))&&(E=void 0,o+=D.length,s(f.ignore)&&f.ignore.length&&e[o+1]&&f.ignore.some(b=>ve(e,o,b.tails,{trimBeforeMatching:!0,cb:(C,ge,fe)=>{var ce;return fe&&(o=fe-1,(ce=e[o+1])!=null&&ce.trim()&&(h+=1)),!0}})))),e[o]&&`\r
30
+ `.includes(e[o])&&(h=0,m=0),s(f.tagRanges)&&f.tagRanges.length&&f.tagRanges.some(b=>{if(o>=b[0]&&o<=b[1]&&b[1]-1>o)return o=b[1]-1,!0})}return K(e,t.current()).split("").forEach((o,D)=>{}),{res:K(e,t.current(),f.reportProgressFunc?o=>{c=Math.floor((f.reportProgressFuncTo-f.reportProgressFuncFrom)*(1-n)+o/100*(f.reportProgressFuncTo-f.reportProgressFuncFrom)*n),c!==p&&(p=c,f.reportProgressFunc(c))}:void 0),ranges:t.current(),log:{timeTakenInMilliseconds:Date.now()-a},whatWasDone:W}}return Ge(ut);})();
31
31
  /**
32
32
  * @name arrayiffy-if-string
33
33
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
34
- * @version 5.0.5
34
+ * @version 5.0.6
35
35
  * @author Roy Revelt, Codsen Ltd
36
36
  * @license MIT
37
37
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -39,7 +39,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
39
39
  /**
40
40
  * @name codsen-utils
41
41
  * @fileoverview Various utility functions
42
- * @version 1.6.0
42
+ * @version 1.6.1
43
43
  * @author Roy Revelt, Codsen Ltd
44
44
  * @license MIT
45
45
  * {@link https://codsen.com/os/codsen-utils/}
@@ -47,7 +47,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
47
47
  /**
48
48
  * @name string-match-left-right
49
49
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
50
- * @version 9.0.13
50
+ * @version 9.0.14
51
51
  * @author Roy Revelt, Codsen Ltd
52
52
  * @license MIT
53
53
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -55,7 +55,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
55
55
  /**
56
56
  * @name string-left-right
57
57
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
58
- * @version 6.0.13
58
+ * @version 6.0.14
59
59
  * @author Roy Revelt, Codsen Ltd
60
60
  * @license MIT
61
61
  * {@link https://codsen.com/os/string-left-right/}
@@ -63,7 +63,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
63
63
  /**
64
64
  * @name string-collapse-leading-whitespace
65
65
  * @fileoverview Collapse the leading and trailing whitespace of a string
66
- * @version 7.0.5
66
+ * @version 7.0.6
67
67
  * @author Roy Revelt, Codsen Ltd
68
68
  * @license MIT
69
69
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -71,7 +71,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
71
71
  /**
72
72
  * @name ranges-sort
73
73
  * @fileoverview Sort string index ranges
74
- * @version 6.0.8
74
+ * @version 6.0.9
75
75
  * @author Roy Revelt, Codsen Ltd
76
76
  * @license MIT
77
77
  * {@link https://codsen.com/os/ranges-sort/}
@@ -79,7 +79,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
79
79
  /**
80
80
  * @name ranges-push
81
81
  * @fileoverview Gather string index ranges
82
- * @version 7.0.10
82
+ * @version 7.0.11
83
83
  * @author Roy Revelt, Codsen Ltd
84
84
  * @license MIT
85
85
  * {@link https://codsen.com/os/ranges-push/}
@@ -87,7 +87,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
87
87
  /**
88
88
  * @name ranges-merge
89
89
  * @fileoverview Merge and sort string index ranges
90
- * @version 9.0.10
90
+ * @version 9.0.11
91
91
  * @author Roy Revelt, Codsen Ltd
92
92
  * @license MIT
93
93
  * {@link https://codsen.com/os/ranges-merge/}
@@ -95,7 +95,7 @@ ${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new Error(`string-r
95
95
  /**
96
96
  * @name ranges-apply
97
97
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
98
- * @version 7.0.10
98
+ * @version 7.0.11
99
99
  * @author Roy Revelt, Codsen Ltd
100
100
  * @license MIT
101
101
  * {@link https://codsen.com/os/ranges-apply/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-remove-widows",
3
- "version": "4.0.15",
3
+ "version": "4.0.16",
4
4
  "description": "Helps to prevent widow words in a text",
5
5
  "keywords": [
6
6
  "against",
@@ -44,7 +44,7 @@
44
44
  "cjs-on": "exit 0",
45
45
  "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
46
46
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
47
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --loglevel 'silent'",
47
+ "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
48
48
  "examples": "node '../../ops/scripts/run-examples.js'",
49
49
  "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
50
50
  "letspublish": "npm publish || :",
@@ -52,7 +52,7 @@
52
52
  "perf": "node perf/check.js",
53
53
  "prep": "echo 'ready'",
54
54
  "prettier": "prettier",
55
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --loglevel 'silent'",
55
+ "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
56
56
  "pretest": "npm run lect && npm run build",
57
57
  "test": "npm run devtest",
58
58
  "unit": "uvu test"
@@ -75,13 +75,13 @@
75
75
  }
76
76
  },
77
77
  "dependencies": {
78
- "codsen-utils": "^1.6.0",
79
- "ranges-apply": "^7.0.10",
80
- "ranges-push": "^7.0.10",
81
- "string-left-right": "^6.0.13",
82
- "string-match-left-right": "^9.0.13"
78
+ "codsen-utils": "^1.6.1",
79
+ "ranges-apply": "^7.0.11",
80
+ "ranges-push": "^7.0.11",
81
+ "string-left-right": "^6.0.14",
82
+ "string-match-left-right": "^9.0.14"
83
83
  },
84
84
  "devDependencies": {
85
- "string-strip-html": "^13.4.1"
85
+ "string-strip-html": "^13.4.2"
86
86
  }
87
87
  }