html-crush 6.0.12 → 6.0.13

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,13 +1,13 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minify email templates
4
- * @version 6.0.12
4
+ * @version 6.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/html-crush/}
8
8
  */
9
9
 
10
- import{rApply as ne}from"ranges-apply";import{Ranges as le}from"ranges-push";import{matchLeft as oe,matchRight as F,matchRightIncl as X}from"string-match-left-right";import{expander as _}from"string-range-expander";import{left as G,right as a}from"string-left-right";import{isStr as A,isLetter as y,isPlainObject as te}from"codsen-utils";var Y="6.0.12";var be=Y,$=new le({limitToBeAddedWhitespace:!0}),ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function he(n,E){let x=Date.now();if(!A(n))throw n===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
10
+ import{rApply as ne}from"ranges-apply";import{Ranges as le}from"ranges-push";import{matchLeft as oe,matchRight as F,matchRightIncl as X}from"string-match-left-right";import{expander as _}from"string-range-expander";import{left as G,right as a}from"string-left-right";import{isStr as A,isLetter as y,isPlainObject as te}from"codsen-utils";var Y="6.0.13";var be=Y,$=new le({limitToBeAddedWhitespace:!0}),ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function he(n,E){let x=Date.now();if(!A(n))throw n===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
11
11
  ${JSON.stringify(n,null,4)}`);if(E&&!te(E))throw new Error(`html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof E}, equal to ${JSON.stringify(E,null,4)}`);if(E&&Array.isArray(E.breakToTheLeftOf)&&E.breakToTheLeftOf.length){for(let e=0,w=E.breakToTheLeftOf.length;e<w;e++)if(!A(E.breakToTheLeftOf[e]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${e} is of a type "${typeof E.breakToTheLeftOf[e]}" and is equal to:
12
12
  ${JSON.stringify(E.breakToTheLeftOf[e],null,4)}`)}let l={...ie,...E};typeof l.removeHTMLComments=="boolean"&&(l.removeHTMLComments=l.removeHTMLComments?1:0);let v="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(v=[...new Set(l.breakToTheLeftOf.map(e=>e[0]))].join(""));let L={removeHTMLComments:!1,removeCSSComments:!1},p=null,i=null,S=!1,m=0,H=0,g=!1,O=!1,c=null,f=null,V=null,U=null,u,t=null,s=null,r=null,T=null,D=null,M=null,P=">};",I="<",K="!",q=">",z="<",W="{},:;<>~+",k=W,J=W,C=!0,h=n.length,Q=Math.floor(h/2),B=.01,j;l.reportProgressFunc&&(j=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*B-l.reportProgressFuncFrom));let d,R=0,b=`
13
13
  `;if(n.includes(`\r
@@ -1,43 +1,43 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minify email templates
4
- * @version 6.0.12
4
+ * @version 6.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/html-crush/}
8
8
  */
9
9
 
10
- "use strict";var htmlCrush=(()=>{var ve=Object.create;var G=Object.defineProperty;var Ne=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames,se=Object.getOwnPropertySymbols,Ve=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var Z=(e,o,u)=>o in e?G(e,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[o]=u,w=(e,o)=>{for(var u in o||(o={}))ae.call(o,u)&&Z(e,u,o[u]);if(se)for(var u of se(o))Me.call(o,u)&&Z(e,u,o[u]);return e};var Pe=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),Fe=(e,o)=>{for(var u in o)G(e,u,{get:o[u],enumerable:!0})},ue=(e,o,u,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Re(o))!ae.call(e,s)&&s!==u&&G(e,s,{get:()=>o[s],enumerable:!(t=Ne(o,s))||t.enumerable});return e};var _e=(e,o,u)=>(u=e!=null?ve(Ve(e)):{},ue(o||!e||!e.__esModule?G(u,"default",{value:e,enumerable:!0}):u,e)),He=e=>ue(G({},"__esModule",{value:!0}),e);var ee=(e,o,u)=>(Z(e,typeof o!="symbol"?o+"":o,u),u);var Ee=Pe((Lt,ye)=>{"use strict";ye.exports=Ge;function J(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Ge(e){if(e=e||{},e.circles)return qe(e);return e.proto?t:u;function o(s,r){for(var a=Object.keys(s),l=new Array(a.length),g=0;g<a.length;g++){var i=a[g],$=s[i];typeof $!="object"||$===null?l[i]=$:$ instanceof Date?l[i]=new Date($):ArrayBuffer.isView($)?l[i]=J($):l[i]=r($)}return l}function u(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return o(s,u);if(s instanceof Map)return new Map(o(Array.from(s),u));if(s instanceof Set)return new Set(o(Array.from(s),u));var r={};for(var a in s)if(Object.hasOwnProperty.call(s,a)!==!1){var l=s[a];typeof l!="object"||l===null?r[a]=l:l instanceof Date?r[a]=new Date(l):l instanceof Map?r[a]=new Map(o(Array.from(l),u)):l instanceof Set?r[a]=new Set(o(Array.from(l),u)):ArrayBuffer.isView(l)?r[a]=J(l):r[a]=u(l)}return r}function t(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return o(s,t);if(s instanceof Map)return new Map(o(Array.from(s),t));if(s instanceof Set)return new Set(o(Array.from(s),t));var r={};for(var a in s){var l=s[a];typeof l!="object"||l===null?r[a]=l:l instanceof Date?r[a]=new Date(l):l instanceof Map?r[a]=new Map(o(Array.from(l),t)):l instanceof Set?r[a]=new Set(o(Array.from(l),t)):ArrayBuffer.isView(l)?r[a]=J(l):r[a]=t(l)}return r}}function qe(e){var o=[],u=[];return e.proto?r:s;function t(a,l){for(var g=Object.keys(a),i=new Array(g.length),$=0;$<g.length;$++){var d=g[$],b=a[d];if(typeof b!="object"||b===null)i[d]=b;else if(b instanceof Date)i[d]=new Date(b);else if(ArrayBuffer.isView(b))i[d]=J(b);else{var f=o.indexOf(b);f!==-1?i[d]=u[f]:i[d]=l(b)}}return i}function s(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(Array.isArray(a))return t(a,s);if(a instanceof Map)return new Map(t(Array.from(a),s));if(a instanceof Set)return new Set(t(Array.from(a),s));var l={};o.push(a),u.push(l);for(var g in a)if(Object.hasOwnProperty.call(a,g)!==!1){var i=a[g];if(typeof i!="object"||i===null)l[g]=i;else if(i instanceof Date)l[g]=new Date(i);else if(i instanceof Map)l[g]=new Map(t(Array.from(i),s));else if(i instanceof Set)l[g]=new Set(t(Array.from(i),s));else if(ArrayBuffer.isView(i))l[g]=J(i);else{var $=o.indexOf(i);$!==-1?l[g]=u[$]:l[g]=s(i)}}return o.pop(),u.pop(),l}function r(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(Array.isArray(a))return t(a,r);if(a instanceof Map)return new Map(t(Array.from(a),r));if(a instanceof Set)return new Set(t(Array.from(a),r));var l={};o.push(a),u.push(l);for(var g in a){var i=a[g];if(typeof i!="object"||i===null)l[g]=i;else if(i instanceof Date)l[g]=new Date(i);else if(i instanceof Map)l[g]=new Map(t(Array.from(i),r));else if(i instanceof Set)l[g]=new Set(t(Array.from(i),r));else if(ArrayBuffer.isView(i))l[g]=J(i);else{var $=o.indexOf(i);$!==-1?l[g]=u[$]:l[g]=r(i)}}return o.pop(),u.pop(),l}}});var Ze={};Fe(Ze,{crush:()=>Xe,defaults:()=>Oe,version:()=>Qe});var xe={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function x(e,o){if(!Array.isArray(e)||!e.length)return e;let u=w(w({},xe),o),t,s;if(u.strictlyTwoElementsInRangeArrays&&!e.every((l,g)=>!Array.isArray(l)||l.length!==2?(t=g,s=l.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, ${t}th range (${JSON.stringify(e[t],null,4)}) has not two but ${s} elements!`);if(!e.every((l,g)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(t=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${t}th range (${JSON.stringify(e[t],null,4)}) does not consist of only natural numbers!`);let r=e.length**2,a=0;return Array.from(e).sort((l,g)=>(u.progressFn&&(a+=1,u.progressFn(Math.floor(a*100/r))),l[0]===g[0]?l[1]<g[1]?-1:l[1]>g[1]?1:0:l[0]<g[0]?-1:1))}var ge={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function me(e,o){function u(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let t;if(o)if(u(o)){if(t=w(w({},ge),o),t.progressFn&&u(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof t.progressFn}", equal to ${JSON.stringify(t.progressFn,null,4)}`);if(![1,2,"1","2"].includes(t.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof t.joinRangesThatTouchEdges}", equal to ${JSON.stringify(t.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
11
- ${JSON.stringify(o,null,4)} (type ${typeof o})`);else t=w({},ge);let s=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),r,a,l;t.progressFn?r=x(s,{progressFn:i=>{l=Math.floor(i/5),l!==a&&(a=l,t.progressFn(l))}}):r=x(s);let g=r.length-1;for(let i=g;i>0;i--)t.progressFn&&(l=Math.floor((1-i/g)*78)+21,l!==a&&l>a&&(a=l,t.progressFn(l))),(r[i][0]<=r[i-1][0]||!t.joinRangesThatTouchEdges&&r[i][0]<r[i-1][1]||t.joinRangesThatTouchEdges&&r[i][0]<=r[i-1][1])&&(r[i-1][0]=Math.min(r[i][0],r[i-1][0]),r[i-1][1]=Math.max(r[i][1],r[i-1][1]),r[i][2]!==void 0&&(r[i-1][0]>=r[i][0]||r[i-1][1]<=r[i][1])&&r[i-1][2]!==null&&(r[i][2]===null&&r[i-1][2]!==null?r[i-1][2]=null:r[i-1][2]!=null?+t.mergeType==2&&r[i-1][0]===r[i][0]?r[i-1][2]=r[i][2]:r[i-1][2]+=r[i][2]:r[i-1][2]=r[i][2]),r.splice(i,1),i=r.length);return r.length?r:null}var We=!0,te="Invariant failed";function fe(e,o){if(!e){if(We)throw new Error(te);var u=typeof o=="function"?o():o,t=u?"".concat(te,": ").concat(u):te;throw new Error(t)}}function $e(e,o,u){let t=0,s=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(o&&!Array.isArray(o))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof o}, equal to: ${JSON.stringify(o,null,4)}`);if(u&&typeof u!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof u}, equal to: ${JSON.stringify(u,null,4)}`);if(!(o!=null&&o.filter($=>$).length))return e;let r;Array.isArray(o)&&Number.isInteger(o[0])&&Number.isInteger(o[1])?r=[Array.from(o)]:r=Array.from(o);let a=r.length,l=0;r.filter($=>$).forEach(($,d)=>{if(u&&(t=Math.floor(l/a*10),t!==s&&(s=t,u(t))),!Array.isArray($))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${d}th element not an array: ${JSON.stringify($,null,4)}, which is ${typeof $}`);if(!Number.isInteger($[0])){if(!Number.isInteger(+$[0])||+$[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${d}th element, array ${JSON.stringify($,null,0)}. Its first element is not an integer, string index, but ${typeof $[0]}, equal to: ${JSON.stringify($[0],null,4)}.`);r[d][0]=+r[d][0]}if(!Number.isInteger($[1])){if(!Number.isInteger(+$[1])||+$[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${d}th element, array ${JSON.stringify($,null,0)}. Its second element is not an integer, string index, but ${typeof $[1]}, equal to: ${JSON.stringify($[1],null,4)}.`);r[d][1]=+r[d][1]}l+=1});let g=me(r,{progressFn:$=>{u&&(t=10+Math.floor($/10),t!==s&&(s=t,u(t)))}});fe(g);let i=g.length;if(i>0){let $=e.slice(g[i-1][1]);e=g.reduce((d,b,f,c)=>{u&&(t=20+Math.floor(f/i*80),t!==s&&(s=t,u(t)));let O=f===0?0:c[f-1][1],D=c[f][0];return`${d}${e.slice(O,D)}${c[f][2]||""}`},""),e+=$}return e}function Y(e,o=1){let u="\xA0";function t(r){return Array.from(r).reverse().join("")}function s(r,a,l){let g=l?`
10
+ "use strict";var htmlCrush=(()=>{var Re=Object.create;var G=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames,ae=Object.getOwnPropertySymbols,Pe=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable;var Z=(e,o,u)=>o in e?G(e,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[o]=u,w=(e,o)=>{for(var u in o||(o={}))ue.call(o,u)&&Z(e,u,o[u]);if(ae)for(var u of ae(o))Fe.call(o,u)&&Z(e,u,o[u]);return e};var _e=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),He=(e,o)=>{for(var u in o)G(e,u,{get:o[u],enumerable:!0})},ge=(e,o,u,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Me(o))!ue.call(e,s)&&s!==u&&G(e,s,{get:()=>o[s],enumerable:!(t=Ve(o,s))||t.enumerable});return e};var me=(e,o,u)=>(u=e!=null?Re(Pe(e)):{},ge(o||!e||!e.__esModule?G(u,"default",{value:e,enumerable:!0}):u,e)),xe=e=>ge(G({},"__esModule",{value:!0}),e);var ee=(e,o,u)=>(Z(e,typeof o!="symbol"?o+"":o,u),u);var ne=_e((ft,pe)=>{"use strict";pe.exports=Be;function W(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Be(e){if(e=e||{},e.circles)return je(e);return e.proto?t:u;function o(s,r){for(var a=Object.keys(s),l=new Array(a.length),g=0;g<a.length;g++){var i=a[g],$=s[i];typeof $!="object"||$===null?l[i]=$:$ instanceof Date?l[i]=new Date($):ArrayBuffer.isView($)?l[i]=W($):l[i]=r($)}return l}function u(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return o(s,u);if(s instanceof Map)return new Map(o(Array.from(s),u));if(s instanceof Set)return new Set(o(Array.from(s),u));var r={};for(var a in s)if(Object.hasOwnProperty.call(s,a)!==!1){var l=s[a];typeof l!="object"||l===null?r[a]=l:l instanceof Date?r[a]=new Date(l):l instanceof Map?r[a]=new Map(o(Array.from(l),u)):l instanceof Set?r[a]=new Set(o(Array.from(l),u)):ArrayBuffer.isView(l)?r[a]=W(l):r[a]=u(l)}return r}function t(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return o(s,t);if(s instanceof Map)return new Map(o(Array.from(s),t));if(s instanceof Set)return new Set(o(Array.from(s),t));var r={};for(var a in s){var l=s[a];typeof l!="object"||l===null?r[a]=l:l instanceof Date?r[a]=new Date(l):l instanceof Map?r[a]=new Map(o(Array.from(l),t)):l instanceof Set?r[a]=new Set(o(Array.from(l),t)):ArrayBuffer.isView(l)?r[a]=W(l):r[a]=t(l)}return r}}function je(e){var o=[],u=[];return e.proto?r:s;function t(a,l){for(var g=Object.keys(a),i=new Array(g.length),$=0;$<g.length;$++){var d=g[$],b=a[d];if(typeof b!="object"||b===null)i[d]=b;else if(b instanceof Date)i[d]=new Date(b);else if(ArrayBuffer.isView(b))i[d]=W(b);else{var f=o.indexOf(b);f!==-1?i[d]=u[f]:i[d]=l(b)}}return i}function s(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(Array.isArray(a))return t(a,s);if(a instanceof Map)return new Map(t(Array.from(a),s));if(a instanceof Set)return new Set(t(Array.from(a),s));var l={};o.push(a),u.push(l);for(var g in a)if(Object.hasOwnProperty.call(a,g)!==!1){var i=a[g];if(typeof i!="object"||i===null)l[g]=i;else if(i instanceof Date)l[g]=new Date(i);else if(i instanceof Map)l[g]=new Map(t(Array.from(i),s));else if(i instanceof Set)l[g]=new Set(t(Array.from(i),s));else if(ArrayBuffer.isView(i))l[g]=W(i);else{var $=o.indexOf(i);$!==-1?l[g]=u[$]:l[g]=s(i)}}return o.pop(),u.pop(),l}function r(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(Array.isArray(a))return t(a,r);if(a instanceof Map)return new Map(t(Array.from(a),r));if(a instanceof Set)return new Set(t(Array.from(a),r));var l={};o.push(a),u.push(l);for(var g in a){var i=a[g];if(typeof i!="object"||i===null)l[g]=i;else if(i instanceof Date)l[g]=new Date(i);else if(i instanceof Map)l[g]=new Map(t(Array.from(i),r));else if(i instanceof Set)l[g]=new Set(t(Array.from(i),r));else if(ArrayBuffer.isView(i))l[g]=W(i);else{var $=o.indexOf(i);$!==-1?l[g]=u[$]:l[g]=r(i)}}return o.pop(),u.pop(),l}}});var et={};He(et,{crush:()=>Ze,defaults:()=>Le,version:()=>Xe});var We={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function x(e,o){if(!Array.isArray(e)||!e.length)return e;let u=w(w({},We),o),t,s;if(u.strictlyTwoElementsInRangeArrays&&!e.every((l,g)=>!Array.isArray(l)||l.length!==2?(t=g,s=l.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, ${t}th range (${JSON.stringify(e[t],null,4)}) has not two but ${s} elements!`);if(!e.every((l,g)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(t=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${t}th range (${JSON.stringify(e[t],null,4)}) does not consist of only natural numbers!`);let r=e.length**2,a=0;return Array.from(e).sort((l,g)=>(u.progressFn&&(a+=1,u.progressFn(Math.floor(a*100/r))),l[0]===g[0]?l[1]<g[1]?-1:l[1]>g[1]?1:0:l[0]<g[0]?-1:1))}var fe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function $e(e,o){function u(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let t;if(o)if(u(o)){if(t=w(w({},fe),o),t.progressFn&&u(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof t.progressFn}", equal to ${JSON.stringify(t.progressFn,null,4)}`);if(![1,2,"1","2"].includes(t.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof t.joinRangesThatTouchEdges}", equal to ${JSON.stringify(t.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
11
+ ${JSON.stringify(o,null,4)} (type ${typeof o})`);else t=w({},fe);let s=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),r,a,l;t.progressFn?r=x(s,{progressFn:i=>{l=Math.floor(i/5),l!==a&&(a=l,t.progressFn(l))}}):r=x(s);let g=r.length-1;for(let i=g;i>0;i--)t.progressFn&&(l=Math.floor((1-i/g)*78)+21,l!==a&&l>a&&(a=l,t.progressFn(l))),(r[i][0]<=r[i-1][0]||!t.joinRangesThatTouchEdges&&r[i][0]<r[i-1][1]||t.joinRangesThatTouchEdges&&r[i][0]<=r[i-1][1])&&(r[i-1][0]=Math.min(r[i][0],r[i-1][0]),r[i-1][1]=Math.max(r[i][1],r[i-1][1]),r[i][2]!==void 0&&(r[i-1][0]>=r[i][0]||r[i-1][1]<=r[i][1])&&r[i-1][2]!==null&&(r[i][2]===null&&r[i-1][2]!==null?r[i-1][2]=null:r[i-1][2]!=null?+t.mergeType==2&&r[i-1][0]===r[i][0]?r[i-1][2]=r[i][2]:r[i-1][2]+=r[i][2]:r[i-1][2]=r[i][2]),r.splice(i,1),i=r.length);return r.length?r:null}var Je=!0,te="Invariant failed";function he(e,o){if(!e){if(Je)throw new Error(te);var u=typeof o=="function"?o():o,t=u?"".concat(te,": ").concat(u):te;throw new Error(t)}}function ce(e,o,u){let t=0,s=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(o&&!Array.isArray(o))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof o}, equal to: ${JSON.stringify(o,null,4)}`);if(u&&typeof u!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof u}, equal to: ${JSON.stringify(u,null,4)}`);if(!(o!=null&&o.filter($=>$).length))return e;let r;Array.isArray(o)&&Number.isInteger(o[0])&&Number.isInteger(o[1])?r=[Array.from(o)]:r=Array.from(o);let a=r.length,l=0;r.filter($=>$).forEach(($,d)=>{if(u&&(t=Math.floor(l/a*10),t!==s&&(s=t,u(t))),!Array.isArray($))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${d}th element not an array: ${JSON.stringify($,null,4)}, which is ${typeof $}`);if(!Number.isInteger($[0])){if(!Number.isInteger(+$[0])||+$[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${d}th element, array ${JSON.stringify($,null,0)}. Its first element is not an integer, string index, but ${typeof $[0]}, equal to: ${JSON.stringify($[0],null,4)}.`);r[d][0]=+r[d][0]}if(!Number.isInteger($[1])){if(!Number.isInteger(+$[1])||+$[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${d}th element, array ${JSON.stringify($,null,0)}. Its second element is not an integer, string index, but ${typeof $[1]}, equal to: ${JSON.stringify($[1],null,4)}.`);r[d][1]=+r[d][1]}l+=1});let g=$e(r,{progressFn:$=>{u&&(t=10+Math.floor($/10),t!==s&&(s=t,u(t)))}});he(g);let i=g.length;if(i>0){let $=e.slice(g[i-1][1]);e=g.reduce((d,b,f,c)=>{u&&(t=20+Math.floor(f/i*80),t!==s&&(s=t,u(t)));let O=f===0?0:c[f-1][1],D=c[f][0];return`${d}${e.slice(O,D)}${c[f][2]||""}`},""),e+=$}return e}function Y(e,o=1){let u="\xA0";function t(r){return Array.from(r).reverse().join("")}function s(r,a,l){let g=l?`
12
12
  `:"\r",i=l?"\r":`
13
13
  `;if(!r)return r;let $=0,d=0,b="";for(let f=0,c=r.length;f<c;f++)(r[f]===g||r[f]===i&&r[f-1]!==g)&&d++,`\r
14
- `.includes(r[f])||r[f]===u?($=0,r[f]===u?b+=r[f]:r[f]===g?d<=a&&(b+=r[f],r[f+1]===i&&(b+=r[f+1],f++)):r[f]===i&&(r==null?void 0:r[f-1])!==g&&d<=a&&(b+=r[f])):($++,!r[f+1]&&!d&&(b+=" "));return b}if(typeof e=="string"&&e.length){let r=1;typeof+o=="number"&&Number.isInteger(+o)&&+o>=0&&(r=+o);let a="",l="";if(!e.trim())a=e;else if(!e[0].trim()){for(let g=0,i=e.length;g<i;g++)if(e[g].trim()){a=e.slice(0,g);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===u)){for(let g=e.length;g--;)if(e[g].trim()){l=e.slice(g+1);break}}return`${s(a,r,!1)}${e.trim()}${t(s(t(l),r,!0))}`}return e}function F(e){return S(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function R(e){if(e==null||typeof e!="object")return!1;let o=Object.getPrototypeOf(e);return o!==null&&o!==Object.prototype&&Object.getPrototypeOf(o)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function S(e){return typeof e=="string"}function N(e){return Number.isSafeInteger(e)&&e>=0}function V(e){return e!=null}function he(e,o){return R(e)&&S(o)&&o in e}var ce={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Je(e,o){function u(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let t;if(o)if(u(o)){if(t=w(w({},ce),o),t.progressFn&&u(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof t.progressFn}", equal to ${JSON.stringify(t.progressFn,null,4)}`);if(![1,2,"1","2"].includes(t.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof t.joinRangesThatTouchEdges}", equal to ${JSON.stringify(t.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
15
- ${JSON.stringify(o,null,4)} (type ${typeof o})`);else t=w({},ce);let s=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),r,a,l;t.progressFn?r=x(s,{progressFn:i=>{l=Math.floor(i/5),l!==a&&(a=l,t.progressFn(l))}}):r=x(s);let g=r.length-1;for(let i=g;i>0;i--)t.progressFn&&(l=Math.floor((1-i/g)*78)+21,l!==a&&l>a&&(a=l,t.progressFn(l))),(r[i][0]<=r[i-1][0]||!t.joinRangesThatTouchEdges&&r[i][0]<r[i-1][1]||t.joinRangesThatTouchEdges&&r[i][0]<=r[i-1][1])&&(r[i-1][0]=Math.min(r[i][0],r[i-1][0]),r[i-1][1]=Math.max(r[i][1],r[i-1][1]),r[i][2]!==void 0&&(r[i-1][0]>=r[i][0]||r[i-1][1]<=r[i][1])&&r[i-1][2]!==null&&(r[i][2]===null&&r[i-1][2]!==null?r[i-1][2]=null:r[i-1][2]!=null?+t.mergeType==2&&r[i-1][0]===r[i][0]?r[i-1][2]=r[i][2]:r[i-1][2]+=r[i][2]:r[i-1][2]=r[i][2]),r.splice(i,1),i=r.length);return r.length?r:null}var Be={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},pe=class{constructor(e){ee(this,"ranges");ee(this,"opts");let o=w(w({},Be),e);if(o.mergeType&&o.mergeType!==1&&o.mergeType!==2)if(S(o.mergeType)&&o.mergeType.trim()==="1")o.mergeType=1;else if(S(o.mergeType)&&o.mergeType.trim()==="2")o.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 o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);this.opts=o,this.ranges=[]}add(e,o,u){var r;if(e==null&&o==null)return;if(V(e)&&!V(o)){if(Array.isArray(e)){if(e.length){if(e.some(a=>Array.isArray(a))){e.forEach(a=>{Array.isArray(a)&&this.add(...a)});return}e.length&&N(+e[0])&&N(+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(o,null,0)})`)}else if(!V(e)&&V(o))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(o,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let t=+e,s=+o;if(N(u)&&(u=String(u)),N(t)&&N(s)){if(V(u)&&!S(u)&&!N(u))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof u}, equal to:
16
- ${JSON.stringify(u,null,4)}`);if(V(this.ranges)&&Array.isArray(this.last())&&t===this.last()[1]){if(this.last()[1]=s,this.last()[2],this.last()[2]!==null&&V(u)){let a=this.last()[2]&&this.last()[2].length&&(!((r=this.opts)!=null&&r.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${u}`:u;this.opts.limitToBeAddedWhitespace&&(a=Y(a,this.opts.limitLinebreaksCount)),S(a)&&!a.length||(this.last()[2]=a)}}else{this.ranges||(this.ranges=[]);let a=u!==void 0&&!(S(u)&&!u.length)?[t,s,u&&this.opts.limitToBeAddedWhitespace?Y(u,this.opts.limitLinebreaksCount):u]:[t,s];this.ranges.push(a)}}else throw N(t)&&t>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof s}" equal to: ${JSON.stringify(s,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 t}" equal to: ${JSON.stringify(t,null,4)}`)}push(e,o,u){this.add(e,o,u)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Je(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>V(e[2])?[e[0],e[1],Y(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&N(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}};function de(e){return typeof e!="string"?e:e.length?[e]:[]}var be={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},je=e=>e+1;function Ue(e,o,u,t,s=!1,r=je){let a=typeof u=="function"?u():u;if(+o<0&&s&&a==="EOL")return a;let l=w(w({},be),t);if(o>=e.length&&!s)return!1;let g=s?1:u.length,i=0,$=!1,d=!1,b=!1,f=l.maxMismatches,c=o,O=!1,D=!1,T=!1;function h(){return i===1&&f<l.maxMismatches-1}for(;e[c];){let p=r(c);if(l.trimBeforeMatching&&e[c].trim()===""){if(!e[p]&&s&&u==="EOL")return!0;c=r(c);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[c])||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(A=>A.toLowerCase()).includes(e[c].toLowerCase())){if(s&&u==="EOL"&&!e[p])return!0;c=r(c);continue}let y=p>c?u[u.length-g]:u[g-1];if(!l.i&&e[c]===y||l.i&&e[c].toLowerCase()===y.toLowerCase()){if(O||(O=!0),b||(b=!0),g===u.length){if(D=!0,f!==l.maxMismatches)return!1}else g===1&&(T=!0);if(g-=1,i++,h())return!1;if(!g)return i!==u.length||f===l.maxMismatches||!$?c:!1}else if(!$&&!i&&($=!0),l.maxMismatches&&f&&c){f-=1;for(let A=0;A<=f;A++){let C=p>c?u[u.length-g+1+A]:u[g-2-A],M=e[r(c)];if(C&&(!l.i&&e[c]===C||l.i&&e[c].toLowerCase()===C.toLowerCase())&&(!l.firstMustMatch||g!==u.length)){if(i++,h())return!1;g-=2,O=!0;break}else if(M&&C&&(!l.i&&M===C||l.i&&M.toLowerCase()===C.toLowerCase())&&(!l.firstMustMatch||g!==u.length)){if(!i&&!l.hungry)return!1;g-=1,O=!0;break}else if(C===void 0&&f>=0&&O&&(!l.firstMustMatch||D)&&(!l.lastMustMatch||T))return c}O||(d=c)}else return c===0&&g===1&&!l.lastMustMatch&&b?0:!1;if(d!==!1&&d!==c&&(d=!1),g<1)return c;c=r(c)}if(g>0)return s&&a==="EOL"?!0:l&&l.maxMismatches>=g&&b?d||0:!1}function ne(e,o,u,t,s){var $,d;if(R(s)&&he(s,"trimBeforeMatching")&&s&&typeof s.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(s.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let r=w(w({},be),s);if(typeof r.trimCharsBeforeMatching=="string"&&(r.trimCharsBeforeMatching=de(r.trimCharsBeforeMatching)),r.trimCharsBeforeMatching=r.trimCharsBeforeMatching.map(b=>S(b)?b:String(b)),!S(o)||!o.length)return!1;if(!Number.isInteger(u)||u<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 u}, equal to:
14
+ `.includes(r[f])||r[f]===u?($=0,r[f]===u?b+=r[f]:r[f]===g?d<=a&&(b+=r[f],r[f+1]===i&&(b+=r[f+1],f++)):r[f]===i&&(r==null?void 0:r[f-1])!==g&&d<=a&&(b+=r[f])):($++,!r[f+1]&&!d&&(b+=" "));return b}if(typeof e=="string"&&e.length){let r=1;typeof+o=="number"&&Number.isInteger(+o)&&+o>=0&&(r=+o);let a="",l="";if(!e.trim())a=e;else if(!e[0].trim()){for(let g=0,i=e.length;g<i;g++)if(e[g].trim()){a=e.slice(0,g);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===u)){for(let g=e.length;g--;)if(e[g].trim()){l=e.slice(g+1);break}}return`${s(a,r,!1)}${e.trim()}${t(s(t(l),r,!0))}`}return e}var de=me(ne(),1);var $t=(0,de.default)();function F(e){return S(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function R(e){if(e==null||typeof e!="object")return!1;let o=Object.getPrototypeOf(e);return o!==null&&o!==Object.prototype&&Object.getPrototypeOf(o)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function S(e){return typeof e=="string"}function N(e){return Number.isSafeInteger(e)&&e>=0}function V(e){return e!=null}function be(e,o){return R(e)&&S(o)&&o in e}var Te={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ue(e,o){function u(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let t;if(o)if(u(o)){if(t=w(w({},Te),o),t.progressFn&&u(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof t.progressFn}", equal to ${JSON.stringify(t.progressFn,null,4)}`);if(![1,2,"1","2"].includes(t.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof t.joinRangesThatTouchEdges}", equal to ${JSON.stringify(t.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
15
+ ${JSON.stringify(o,null,4)} (type ${typeof o})`);else t=w({},Te);let s=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),r,a,l;t.progressFn?r=x(s,{progressFn:i=>{l=Math.floor(i/5),l!==a&&(a=l,t.progressFn(l))}}):r=x(s);let g=r.length-1;for(let i=g;i>0;i--)t.progressFn&&(l=Math.floor((1-i/g)*78)+21,l!==a&&l>a&&(a=l,t.progressFn(l))),(r[i][0]<=r[i-1][0]||!t.joinRangesThatTouchEdges&&r[i][0]<r[i-1][1]||t.joinRangesThatTouchEdges&&r[i][0]<=r[i-1][1])&&(r[i-1][0]=Math.min(r[i][0],r[i-1][0]),r[i-1][1]=Math.max(r[i][1],r[i-1][1]),r[i][2]!==void 0&&(r[i-1][0]>=r[i][0]||r[i-1][1]<=r[i][1])&&r[i-1][2]!==null&&(r[i][2]===null&&r[i-1][2]!==null?r[i-1][2]=null:r[i-1][2]!=null?+t.mergeType==2&&r[i-1][0]===r[i][0]?r[i-1][2]=r[i][2]:r[i-1][2]+=r[i][2]:r[i-1][2]=r[i][2]),r.splice(i,1),i=r.length);return r.length?r:null}var ke={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},ye=class{constructor(e){ee(this,"ranges");ee(this,"opts");let o=w(w({},ke),e);if(o.mergeType&&o.mergeType!==1&&o.mergeType!==2)if(S(o.mergeType)&&o.mergeType.trim()==="1")o.mergeType=1;else if(S(o.mergeType)&&o.mergeType.trim()==="2")o.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 o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);this.opts=o,this.ranges=[]}add(e,o,u){var r;if(e==null&&o==null)return;if(V(e)&&!V(o)){if(Array.isArray(e)){if(e.length){if(e.some(a=>Array.isArray(a))){e.forEach(a=>{Array.isArray(a)&&this.add(...a)});return}e.length&&N(+e[0])&&N(+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(o,null,0)})`)}else if(!V(e)&&V(o))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(o,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let t=+e,s=+o;if(N(u)&&(u=String(u)),N(t)&&N(s)){if(V(u)&&!S(u)&&!N(u))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof u}, equal to:
16
+ ${JSON.stringify(u,null,4)}`);if(V(this.ranges)&&Array.isArray(this.last())&&t===this.last()[1]){if(this.last()[1]=s,this.last()[2],this.last()[2]!==null&&V(u)){let a=this.last()[2]&&this.last()[2].length&&(!((r=this.opts)!=null&&r.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${u}`:u;this.opts.limitToBeAddedWhitespace&&(a=Y(a,this.opts.limitLinebreaksCount)),S(a)&&!a.length||(this.last()[2]=a)}}else{this.ranges||(this.ranges=[]);let a=u!==void 0&&!(S(u)&&!u.length)?[t,s,u&&this.opts.limitToBeAddedWhitespace?Y(u,this.opts.limitLinebreaksCount):u]:[t,s];this.ranges.push(a)}}else throw N(t)&&t>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof s}" equal to: ${JSON.stringify(s,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 t}" equal to: ${JSON.stringify(t,null,4)}`)}push(e,o,u){this.add(e,o,u)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Ue(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>V(e[2])?[e[0],e[1],Y(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&N(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}};function Ee(e){return typeof e!="string"?e:e.length?[e]:[]}var Se={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Ge=e=>e+1;function qe(e,o,u,t,s=!1,r=Ge){let a=typeof u=="function"?u():u;if(+o<0&&s&&a==="EOL")return a;let l=w(w({},Se),t);if(o>=e.length&&!s)return!1;let g=s?1:u.length,i=0,$=!1,d=!1,b=!1,f=l.maxMismatches,c=o,O=!1,D=!1,T=!1;function h(){return i===1&&f<l.maxMismatches-1}for(;e[c];){let p=r(c);if(l.trimBeforeMatching&&e[c].trim()===""){if(!e[p]&&s&&u==="EOL")return!0;c=r(c);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[c])||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(A=>A.toLowerCase()).includes(e[c].toLowerCase())){if(s&&u==="EOL"&&!e[p])return!0;c=r(c);continue}let y=p>c?u[u.length-g]:u[g-1];if(!l.i&&e[c]===y||l.i&&e[c].toLowerCase()===y.toLowerCase()){if(O||(O=!0),b||(b=!0),g===u.length){if(D=!0,f!==l.maxMismatches)return!1}else g===1&&(T=!0);if(g-=1,i++,h())return!1;if(!g)return i!==u.length||f===l.maxMismatches||!$?c:!1}else if(!$&&!i&&($=!0),l.maxMismatches&&f&&c){f-=1;for(let A=0;A<=f;A++){let C=p>c?u[u.length-g+1+A]:u[g-2-A],M=e[r(c)];if(C&&(!l.i&&e[c]===C||l.i&&e[c].toLowerCase()===C.toLowerCase())&&(!l.firstMustMatch||g!==u.length)){if(i++,h())return!1;g-=2,O=!0;break}else if(M&&C&&(!l.i&&M===C||l.i&&M.toLowerCase()===C.toLowerCase())&&(!l.firstMustMatch||g!==u.length)){if(!i&&!l.hungry)return!1;g-=1,O=!0;break}else if(C===void 0&&f>=0&&O&&(!l.firstMustMatch||D)&&(!l.lastMustMatch||T))return c}O||(d=c)}else return c===0&&g===1&&!l.lastMustMatch&&b?0:!1;if(d!==!1&&d!==c&&(d=!1),g<1)return c;c=r(c)}if(g>0)return s&&a==="EOL"?!0:l&&l.maxMismatches>=g&&b?d||0:!1}function ie(e,o,u,t,s){var $,d;if(R(s)&&be(s,"trimBeforeMatching")&&s&&typeof s.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(s.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let r=w(w({},Se),s);if(typeof r.trimCharsBeforeMatching=="string"&&(r.trimCharsBeforeMatching=Ee(r.trimCharsBeforeMatching)),r.trimCharsBeforeMatching=r.trimCharsBeforeMatching.map(b=>S(b)?b:String(b)),!S(o)||!o.length)return!1;if(!Number.isInteger(u)||u<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 u}, equal to:
17
17
  ${JSON.stringify(u,null,4)}`);let a,l;if(S(t))a=[t];else if(Array.isArray(t))a=t;else if(!t)a=t;else if(typeof t=="function")a=[],a.push(t);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 t}, equal to:
18
18
  ${JSON.stringify(t,null,4)}`);if(s&&!R(s))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 s}", and equal to:
19
- ${JSON.stringify(s,null,4)}`);let g=0,i="";if(r!=null&&r.trimCharsBeforeMatching&&r.trimCharsBeforeMatching.some((b,f)=>b.length>1?(g=f,i=b,!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, ${i.length} (equals to ${i}). Please split it into separate characters and put into array as separate elements.`);if(!a||!Array.isArray(a)||Array.isArray(a)&&!a.length||Array.isArray(a)&&a.length===1&&S(a[0])&&!a[0].trim()){if(typeof r.cb=="function"){let f,c=u;if((e==="matchLeftIncl"||e==="matchRight")&&(c+=1),e[5]==="L")for(let h=c;h--;){let p=o[h];if((!r.trimBeforeMatching||r.trimBeforeMatching&&p!==void 0&&p.trim())&&(!(($=r.trimCharsBeforeMatching)!=null&&$.length)||p!==void 0&&!r.trimCharsBeforeMatching.includes(p))){f=h;break}}else if(e.startsWith("matchRight"))for(let h=c;h<o.length;h++){let p=o[h];if((!r.trimBeforeMatching||r.trimBeforeMatching&&p.trim())&&(!((d=r.trimCharsBeforeMatching)!=null&&d.length)||!r.trimCharsBeforeMatching.includes(p))){f=h;break}}if(f===void 0)return!1;let O=o[f],D=f+1,T="";return D&&D>0&&(T=o.slice(0,D)),e[5]==="L"||f&&f>0&&(T=o.slice(f)),r.cb(O,T,f)}let b="";throw s||(b=" 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!${b}`)}for(let b=0,f=a.length;b<f;b++){l=typeof a[b]=="function";let c=a[b],O,D,T="",h=u;e==="matchRight"?h+=1:e==="matchLeft"&&(h-=1);let p=Ue(o,h,c,r,l,y=>e[5]==="L"?y-1:y+1);if(p&&l&&typeof c=="function"&&c()==="EOL")return c()&&(!r.cb||r.cb(O,T,D))?c():!1;if(Number.isInteger(p)&&(D=e.startsWith("matchLeft")?p-1:p+1,e[5]==="L"?T=o.slice(0,p):T=o.slice(D)),D<0&&(D=void 0),o[D]&&(O=o[D]),Number.isInteger(p)&&(!r.cb||r.cb(O,T,D)))return c}return!1}function Te(e,o,u,t){return ne("matchLeft",e,o,u,t)}function ie(e,o,u,t){return ne("matchRightIncl",e,o,u,t)}function W(e,o,u,t){return ne("matchRight",e,o,u,t)}var ke={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function K(e){var l,g;let o=/^[0-9a-zA-Z]+$/;function u(i){return S(i)&&!i.trim()}if(R(e)){if(!Object.keys(e).length)throw new Error(`string-range-expander: [THROW_ID_02] Input must be a plain object but it's been given as a plain object without any keys. However, "from" and "to" settings are obligatory!`)}else{let i;throw e===void 0?i="but it is missing completely.":e===null?i="but it was given as null.":i=`but it was given as ${typeof e}, equal to:
20
- ${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] Input must be a plain object ${i}`)}if(!N(e.from))throw new Error(`string-range-expander: [THROW_ID_03] The input's "from" value resolvedOpts.from, is not a number! It's been given as ${typeof e.from}, equal to ${JSON.stringify(e.from,null,0)}`);if(!N(e.to))throw new Error(`string-range-expander: [THROW_ID_04] The input's "to" value resolvedOpts.to, is not a number! It's been given as ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if(e!=null&&e.str&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("${e.str}") must contain the character at index before "to" ("${e.to-1}")`);if(e.from>e.to)throw new Error(`string-range-expander: [THROW_ID_07] The given "from" index, "${e.from}" is greater than "to" index, "${e.to}". That's wrong!`);if(e.extendToOneSide===null||S(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!S(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide)throw new Error(`string-range-expander: [THROW_ID_08] The options value "extendToOneSide" is not recognisable! It's set to: "${e.extendToOneSide}" (${typeof e.extendToOneSide}). It has to be either Boolean "false" or one of strings: "left" or "right"`);if(e!=null&&e.ifLeftSideIncludesThisThenCropTightly&&!S(e.ifLeftSideIncludesThisThenCropTightly))throw new Error(`string-range-expander: [THROW_ID_09] The option "ifLeftSideIncludesThisThenCropTightly", is not a string! It's been given as ${typeof e.ifLeftSideIncludesThisThenCropTightly}, equal to ${JSON.stringify(e.ifLeftSideIncludesThisThenCropTightly,null,0)}`);if(e!=null&&e.ifLeftSideIncludesThisCropItToo&&!S(e.ifLeftSideIncludesThisCropItToo))throw new Error(`string-range-expander: [THROW_ID_10] The option "ifLeftSideIncludesThisCropItToo", is not a string! It's been given as ${typeof e.ifLeftSideIncludesThisCropItToo}, equal to ${JSON.stringify(e.ifLeftSideIncludesThisCropItToo,null,0)}`);if(e!=null&&e.ifRightSideIncludesThisThenCropTightly&&!S(e.ifRightSideIncludesThisThenCropTightly))throw new Error(`string-range-expander: [THROW_ID_11] The option "ifRightSideIncludesThisThenCropTightly", is not a string! It's been given as ${typeof e.ifRightSideIncludesThisThenCropTightly}, equal to ${JSON.stringify(e.ifRightSideIncludesThisThenCropTightly,null,0)}`);if(e!=null&&e.ifRightSideIncludesThisCropItToo&&!S(e.ifRightSideIncludesThisCropItToo))throw new Error(`string-range-expander: [THROW_ID_12] The option "ifRightSideIncludesThisCropItToo", is not a string! It's been given as ${typeof e.ifRightSideIncludesThisCropItToo}, equal to ${JSON.stringify(e.ifRightSideIncludesThisCropItToo,null,0)}`);let t=w(w({},ke),e),s=t.str,r=t.from,a=t.to;if(t.extendToOneSide!=="right"&&(u(s[r-1])&&(u(s[r-2])||t.ifLeftSideIncludesThisCropItToo.includes(s[r-2]))||s[r-1]&&t.ifLeftSideIncludesThisCropItToo.includes(s[r-1])||t.wipeAllWhitespaceOnLeft&&u(s[r-1]))){for(let i=r;i--;)if(!t.ifLeftSideIncludesThisCropItToo.includes(s[i])){if(s[i].trim()){t.wipeAllWhitespaceOnLeft||t.ifLeftSideIncludesThisCropItToo.includes(s[i+1])?r=i+1:r=i+2;break}else if(i===0){t.wipeAllWhitespaceOnLeft?r=0:r=1;break}}}if(t.extendToOneSide!=="left"&&(u(s[a])&&(t.wipeAllWhitespaceOnRight||u(s[a+1]))||t.ifRightSideIncludesThisCropItToo.includes(s[a]))){for(let i=a,$=s.length;i<$;i++)if(!t.ifRightSideIncludesThisCropItToo.includes(s[i])){if(s[i].trim()){t.wipeAllWhitespaceOnRight||t.ifRightSideIncludesThisCropItToo.includes(s[i-1])?a=i:a=i-1;break}else if(i===s.length-1){t.wipeAllWhitespaceOnRight?a=s.length:a=s.length-1;break}}}return(t.extendToOneSide!=="right"&&S(t.ifLeftSideIncludesThisThenCropTightly)&&t.ifLeftSideIncludesThisThenCropTightly&&(s[r-2]&&t.ifLeftSideIncludesThisThenCropTightly.includes(s[r-2])||s[r-1]&&t.ifLeftSideIncludesThisThenCropTightly.includes(s[r-1]))||t.extendToOneSide!=="left"&&S(t.ifRightSideIncludesThisThenCropTightly)&&t.ifRightSideIncludesThisThenCropTightly&&(s[a+1]&&t.ifRightSideIncludesThisThenCropTightly.includes(s[a+1])||s[a]&&t.ifRightSideIncludesThisThenCropTightly.includes(s[a])))&&(t.extendToOneSide!=="right"&&u(s[r-1])&&!t.wipeAllWhitespaceOnLeft&&(r-=1),t.extendToOneSide!=="left"&&u(s[a])&&!t.wipeAllWhitespaceOnRight&&(a+=1)),t.addSingleSpaceToPreventAccidentalConcatenation&&((l=s[r-1])!=null&&l.trim())&&((g=s[a])!=null&&g.trim())&&(!t.ifLeftSideIncludesThisThenCropTightly&&!t.ifRightSideIncludesThisThenCropTightly||!((!t.ifLeftSideIncludesThisThenCropTightly||t.ifLeftSideIncludesThisThenCropTightly.includes(s[r-1]))&&(!t.ifRightSideIncludesThisThenCropTightly||s[a]&&t.ifRightSideIncludesThisThenCropTightly.includes(s[a]))))&&(o.test(s[r-1])||o.test(s[a]))?[r,a," "]:[r,a]}var Se=_e(Ee(),1);var It=(0,Se.default)();var B="\xA0";function Ye({str:e,idx:o=0,stopAtNewlines:u=!1,stopAtRawNbsp:t=!1}){if(typeof e!="string"||!e.length||((!o||typeof o!="number")&&(o=0),!e[o+1]))return null;if(e[o+1]&&(e[o+1].trim()||u&&`
19
+ ${JSON.stringify(s,null,4)}`);let g=0,i="";if(r!=null&&r.trimCharsBeforeMatching&&r.trimCharsBeforeMatching.some((b,f)=>b.length>1?(g=f,i=b,!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, ${i.length} (equals to ${i}). Please split it into separate characters and put into array as separate elements.`);if(!a||!Array.isArray(a)||Array.isArray(a)&&!a.length||Array.isArray(a)&&a.length===1&&S(a[0])&&!a[0].trim()){if(typeof r.cb=="function"){let f,c=u;if((e==="matchLeftIncl"||e==="matchRight")&&(c+=1),e[5]==="L")for(let h=c;h--;){let p=o[h];if((!r.trimBeforeMatching||r.trimBeforeMatching&&p!==void 0&&p.trim())&&(!(($=r.trimCharsBeforeMatching)!=null&&$.length)||p!==void 0&&!r.trimCharsBeforeMatching.includes(p))){f=h;break}}else if(e.startsWith("matchRight"))for(let h=c;h<o.length;h++){let p=o[h];if((!r.trimBeforeMatching||r.trimBeforeMatching&&p.trim())&&(!((d=r.trimCharsBeforeMatching)!=null&&d.length)||!r.trimCharsBeforeMatching.includes(p))){f=h;break}}if(f===void 0)return!1;let O=o[f],D=f+1,T="";return D&&D>0&&(T=o.slice(0,D)),e[5]==="L"||f&&f>0&&(T=o.slice(f)),r.cb(O,T,f)}let b="";throw s||(b=" 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!${b}`)}for(let b=0,f=a.length;b<f;b++){l=typeof a[b]=="function";let c=a[b],O,D,T="",h=u;e==="matchRight"?h+=1:e==="matchLeft"&&(h-=1);let p=qe(o,h,c,r,l,y=>e[5]==="L"?y-1:y+1);if(p&&l&&typeof c=="function"&&c()==="EOL")return c()&&(!r.cb||r.cb(O,T,D))?c():!1;if(Number.isInteger(p)&&(D=e.startsWith("matchLeft")?p-1:p+1,e[5]==="L"?T=o.slice(0,p):T=o.slice(D)),D<0&&(D=void 0),o[D]&&(O=o[D]),Number.isInteger(p)&&(!r.cb||r.cb(O,T,D)))return c}return!1}function we(e,o,u,t){return ie("matchLeft",e,o,u,t)}function re(e,o,u,t){return ie("matchRightIncl",e,o,u,t)}function J(e,o,u,t){return ie("matchRight",e,o,u,t)}var Ye={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function K(e){var l,g;let o=/^[0-9a-zA-Z]+$/;function u(i){return S(i)&&!i.trim()}if(R(e)){if(!Object.keys(e).length)throw new Error(`string-range-expander: [THROW_ID_02] Input must be a plain object but it's been given as a plain object without any keys. However, "from" and "to" settings are obligatory!`)}else{let i;throw e===void 0?i="but it is missing completely.":e===null?i="but it was given as null.":i=`but it was given as ${typeof e}, equal to:
20
+ ${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] Input must be a plain object ${i}`)}if(!N(e.from))throw new Error(`string-range-expander: [THROW_ID_03] The input's "from" value resolvedOpts.from, is not a number! It's been given as ${typeof e.from}, equal to ${JSON.stringify(e.from,null,0)}`);if(!N(e.to))throw new Error(`string-range-expander: [THROW_ID_04] The input's "to" value resolvedOpts.to, is not a number! It's been given as ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if(e!=null&&e.str&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("${e.str}") must contain the character at index before "to" ("${e.to-1}")`);if(e.from>e.to)throw new Error(`string-range-expander: [THROW_ID_07] The given "from" index, "${e.from}" is greater than "to" index, "${e.to}". That's wrong!`);if(e.extendToOneSide===null||S(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!S(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide)throw new Error(`string-range-expander: [THROW_ID_08] The options value "extendToOneSide" is not recognisable! It's set to: "${e.extendToOneSide}" (${typeof e.extendToOneSide}). It has to be either Boolean "false" or one of strings: "left" or "right"`);if(e!=null&&e.ifLeftSideIncludesThisThenCropTightly&&!S(e.ifLeftSideIncludesThisThenCropTightly))throw new Error(`string-range-expander: [THROW_ID_09] The option "ifLeftSideIncludesThisThenCropTightly", is not a string! It's been given as ${typeof e.ifLeftSideIncludesThisThenCropTightly}, equal to ${JSON.stringify(e.ifLeftSideIncludesThisThenCropTightly,null,0)}`);if(e!=null&&e.ifLeftSideIncludesThisCropItToo&&!S(e.ifLeftSideIncludesThisCropItToo))throw new Error(`string-range-expander: [THROW_ID_10] The option "ifLeftSideIncludesThisCropItToo", is not a string! It's been given as ${typeof e.ifLeftSideIncludesThisCropItToo}, equal to ${JSON.stringify(e.ifLeftSideIncludesThisCropItToo,null,0)}`);if(e!=null&&e.ifRightSideIncludesThisThenCropTightly&&!S(e.ifRightSideIncludesThisThenCropTightly))throw new Error(`string-range-expander: [THROW_ID_11] The option "ifRightSideIncludesThisThenCropTightly", is not a string! It's been given as ${typeof e.ifRightSideIncludesThisThenCropTightly}, equal to ${JSON.stringify(e.ifRightSideIncludesThisThenCropTightly,null,0)}`);if(e!=null&&e.ifRightSideIncludesThisCropItToo&&!S(e.ifRightSideIncludesThisCropItToo))throw new Error(`string-range-expander: [THROW_ID_12] The option "ifRightSideIncludesThisCropItToo", is not a string! It's been given as ${typeof e.ifRightSideIncludesThisCropItToo}, equal to ${JSON.stringify(e.ifRightSideIncludesThisCropItToo,null,0)}`);let t=w(w({},Ye),e),s=t.str,r=t.from,a=t.to;if(t.extendToOneSide!=="right"&&(u(s[r-1])&&(u(s[r-2])||t.ifLeftSideIncludesThisCropItToo.includes(s[r-2]))||s[r-1]&&t.ifLeftSideIncludesThisCropItToo.includes(s[r-1])||t.wipeAllWhitespaceOnLeft&&u(s[r-1]))){for(let i=r;i--;)if(!t.ifLeftSideIncludesThisCropItToo.includes(s[i])){if(s[i].trim()){t.wipeAllWhitespaceOnLeft||t.ifLeftSideIncludesThisCropItToo.includes(s[i+1])?r=i+1:r=i+2;break}else if(i===0){t.wipeAllWhitespaceOnLeft?r=0:r=1;break}}}if(t.extendToOneSide!=="left"&&(u(s[a])&&(t.wipeAllWhitespaceOnRight||u(s[a+1]))||t.ifRightSideIncludesThisCropItToo.includes(s[a]))){for(let i=a,$=s.length;i<$;i++)if(!t.ifRightSideIncludesThisCropItToo.includes(s[i])){if(s[i].trim()){t.wipeAllWhitespaceOnRight||t.ifRightSideIncludesThisCropItToo.includes(s[i-1])?a=i:a=i-1;break}else if(i===s.length-1){t.wipeAllWhitespaceOnRight?a=s.length:a=s.length-1;break}}}return(t.extendToOneSide!=="right"&&S(t.ifLeftSideIncludesThisThenCropTightly)&&t.ifLeftSideIncludesThisThenCropTightly&&(s[r-2]&&t.ifLeftSideIncludesThisThenCropTightly.includes(s[r-2])||s[r-1]&&t.ifLeftSideIncludesThisThenCropTightly.includes(s[r-1]))||t.extendToOneSide!=="left"&&S(t.ifRightSideIncludesThisThenCropTightly)&&t.ifRightSideIncludesThisThenCropTightly&&(s[a+1]&&t.ifRightSideIncludesThisThenCropTightly.includes(s[a+1])||s[a]&&t.ifRightSideIncludesThisThenCropTightly.includes(s[a])))&&(t.extendToOneSide!=="right"&&u(s[r-1])&&!t.wipeAllWhitespaceOnLeft&&(r-=1),t.extendToOneSide!=="left"&&u(s[a])&&!t.wipeAllWhitespaceOnRight&&(a+=1)),t.addSingleSpaceToPreventAccidentalConcatenation&&((l=s[r-1])!=null&&l.trim())&&((g=s[a])!=null&&g.trim())&&(!t.ifLeftSideIncludesThisThenCropTightly&&!t.ifRightSideIncludesThisThenCropTightly||!((!t.ifLeftSideIncludesThisThenCropTightly||t.ifLeftSideIncludesThisThenCropTightly.includes(s[r-1]))&&(!t.ifRightSideIncludesThisThenCropTightly||s[a]&&t.ifRightSideIncludesThisThenCropTightly.includes(s[a]))))&&(o.test(s[r-1])||o.test(s[a]))?[r,a," "]:[r,a]}var Oe=me(ne(),1);var vt=(0,Oe.default)();var B="\xA0";function Ke({str:e,idx:o=0,stopAtNewlines:u=!1,stopAtRawNbsp:t=!1}){if(typeof e!="string"||!e.length||((!o||typeof o!="number")&&(o=0),!e[o+1]))return null;if(e[o+1]&&(e[o+1].trim()||u&&`
21
21
  \r`.includes(e[o+1])||t&&e[o+1]===B))return o+1;if(e[o+2]&&(e[o+2].trim()||u&&`
22
22
  \r`.includes(e[o+2])||t&&e[o+2]===B))return o+2;for(let s=o+1,r=e.length;s<r;s++)if(e[s].trim()||u&&`
23
- \r`.includes(e[s])||t&&e[s]===B)return s;return null}function L(e,o=0){return Ye({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ke({str:e,idx:o,stopAtNewlines:u,stopAtRawNbsp:t}){if(typeof e!="string"||!e.length||((!o||typeof o!="number")&&(o=0),o<1))return null;if(e[~-o]&&(e[~-o].trim()||u&&`
23
+ \r`.includes(e[s])||t&&e[s]===B)return s;return null}function L(e,o=0){return Ke({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}function ze({str:e,idx:o,stopAtNewlines:u,stopAtRawNbsp:t}){if(typeof e!="string"||!e.length||((!o||typeof o!="number")&&(o=0),o<1))return null;if(e[~-o]&&(e[~-o].trim()||u&&`
24
24
  \r`.includes(e[~-o])||t&&e[~-o]===B))return~-o;if(e[o-2]&&(e[o-2].trim()||u&&`
25
25
  \r`.includes(e[o-2])||t&&e[o-2]===B))return o-2;for(let s=o;s--;)if(e[s]&&(e[s].trim()||u&&`
26
- \r`.includes(e[s])||t&&e[s]===B))return s;return null}function z(e,o=0){return Ke({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}var we="6.0.12";var Qe=we,E=new pe({limitToBeAddedWhitespace:!0}),Oe={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function Xe(e,o){let u=Date.now();if(!S(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
26
+ \r`.includes(e[s])||t&&e[s]===B))return s;return null}function z(e,o=0){return ze({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}var De="6.0.13";var Xe=De,E=new ye({limitToBeAddedWhitespace:!0}),Le={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function Ze(e,o){let u=Date.now();if(!S(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
27
27
  ${JSON.stringify(e,null,4)}`);if(o&&!R(o))throw new Error(`html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof o}, equal to ${JSON.stringify(o,null,4)}`);if(o&&Array.isArray(o.breakToTheLeftOf)&&o.breakToTheLeftOf.length){for(let n=0,k=o.breakToTheLeftOf.length;n<k;n++)if(!S(o.breakToTheLeftOf[n]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${n} is of a type "${typeof o.breakToTheLeftOf[n]}" and is equal to:
28
- ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.removeHTMLComments=="boolean"&&(t.removeHTMLComments=t.removeHTMLComments?1:0);let s="";Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length&&(s=[...new Set(t.breakToTheLeftOf.map(n=>n[0]))].join(""));let r={removeHTMLComments:!1,removeCSSComments:!1},a=null,l=null,g=!1,i=0,$=0,d=!1,b=!1,f=null,c=null,O=null,D=null,T,h=null,p=null,y=null,A=null,C=null,M=null,j=">};",U="<",De="!",Le=">",Ae="<",re="{},:;<>~+",Q=re,X=re,_=!0,v=e.length,Ie=Math.floor(v/2),oe=.01,le;t.reportProgressFunc&&(le=Math.floor(t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*oe-t.reportProgressFuncFrom));let P,q=0,I=`
28
+ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Le),o);typeof t.removeHTMLComments=="boolean"&&(t.removeHTMLComments=t.removeHTMLComments?1:0);let s="";Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length&&(s=[...new Set(t.breakToTheLeftOf.map(n=>n[0]))].join(""));let r={removeHTMLComments:!1,removeCSSComments:!1},a=null,l=null,g=!1,i=0,$=0,d=!1,b=!1,f=null,c=null,O=null,D=null,T,h=null,p=null,y=null,A=null,C=null,M=null,j=">};",U="<",Ae="!",Ie=">",Ce="<",oe="{},:;<>~+",Q=oe,X=oe,_=!0,v=e.length,ve=Math.floor(v/2),le=.01,se;t.reportProgressFunc&&(se=Math.floor(t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*le-t.reportProgressFuncFrom));let P,q=0,I=`
29
29
  `;if(e.includes(`\r
30
30
  `)?I=`\r
31
- `:e.includes("\r")&&(I="\r"),v){for(let n=0;n<v;n++){if(t.reportProgressFunc&&(v>1e3&&v<2e3?n===Ie&&t.reportProgressFunc(Math.floor((t.reportProgressFuncTo-t.reportProgressFuncFrom)/2)):v>=2e3&&(P=t.reportProgressFuncFrom+Math.floor(n/v*(le||1)),P!==q&&(q=P,t.reportProgressFunc(P)))),$++,!T&&d&&e[n]==="}"&&e[n-1]==="}"&&(i+1>=t.lineLengthLimit?(E.push(n,n,I),i=0):(h=n,p=n,y=" ")),T&&typeof T=="number"&&n>=T&&(T=void 0),D!==null&&e.startsWith("<\/script",n)&&!F(e[n+8])){if((t.removeIndentations||t.removeLineBreaks)&&n>0&&e[~-n]&&!e[~-n].trim()){for(let m=n;m--;)if(e[m]===`
32
- `||e[m]==="\r"||e[m].trim()){m+1<n&&E.push(m+1,n);break}}D=null,T=!1,n+=8;continue}if(!T&&!d&&e.startsWith("<script",n)&&!F(e[n+7])){D=n,T=!0;let m="";(t.removeLineBreaks||t.removeIndentations)&&l!==null&&(l>0&&(m=I),E.push(l,n,m)),l=null,a=null}if(C!==null&&A===null&&!/\w/.test(e[n])){A=e.slice(C,n);let m=L(e,~-n);typeof m=="number"&&e[m]===">"&&!e[n].trim()&&L(e,n)?E.push(n,L(e,n)):m&&e[m]==="/"&&e[L(e,m)]===">"&&(!e[n].trim()&&L(e,n)&&E.push(n,L(e,n)),e[m+1]!==">"&&L(e,m+1)&&E.push(m+1,L(e,m+1)))}if(!T&&!d&&!f&&e[~-n]==="<"&&C===null&&(/\w/.test(e[n])?C=n:e[L(e,~-n)]==="/"&&/\w/.test(e[L(e,L(e,~-n))]||"")&&(C=L(e,L(e,~-n)))),!T&&(d||f)&&c!==null&&e[n]==="*"&&e[n+1]==="/"&&([h,p]=K({str:e,from:c,to:n+2,ifLeftSideIncludesThisThenCropTightly:Q||"",ifRightSideIncludesThisThenCropTightly:X||""}),c=null,h!=null?E.push(h,p):(i+=1,n+=1),T=n+2),!T&&(d||f)&&c===null&&e[n]==="/"&&e[n+1]==="*"&&(r.removeCSSComments||(r.removeCSSComments=!0),t.removeCSSComments&&(c=n)),b&&e.startsWith("![endif",n+1)&&(b=!1),!T&&!d&&!f&&O!==null){let m;e.startsWith("-->",n)?m=3:e[n]===">"&&e[n-1]==="]"&&(m=1),m&&([h,p]=K({str:e,from:O,to:n+m}),O=null,h!=null?t.lineLengthLimit&&$-(p-h)>=t.lineLengthLimit?(E.push(h,p,I),$=-m):(E.push(h,p),$-=p-h):(i+=m-1,n+=m-1),T=n+m)}if(!T&&!d&&!f&&(e.startsWith("<!--",n)||t.removeHTMLComments===2&&e.startsWith("<![endif",n))&&O===null&&(e.startsWith("[if",n+4)?(b||(b=!0),t.removeHTMLComments===2&&(O=n)):t.removeHTMLComments&&(!b||t.removeHTMLComments===2)&&(O=n),r.removeHTMLComments||(r.removeHTMLComments=!0)),!T&&d&&c===null&&e.startsWith("</style",n)&&!F(e[n+7])?d=!1:!T&&!d&&c===null&&e.startsWith("<style",n)&&!F(e[n+6])&&(d=!0,(t.removeLineBreaks||t.removeIndentations)&&t.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',n+6)&&e[n+24]&&E.push(n+23,n+23,I)),!T&&!f&&`"'`.includes(e[n])&&e.endsWith("style=",n)&&(f=n),!T&&!e[n].trim())l===null&&(l=n);else if(!T&&!((d||f)&&c!==null)){if(l!==null){if(t.removeLineBreaks&&(i+=1),_)_=!1,(t.removeIndentations||t.removeLineBreaks)&&E.push(0,n);else if(t.removeIndentations&&!t.removeLineBreaks&&(!g&&a!==null&&n>a?E.push(a+1,n):l+1<n&&(e.endsWith("]>",l)||e.endsWith("-->",l)||e.startsWith("<![",n)||e.startsWith("<!--<![",n)?E.push(l,n):e[l]===" "?E.push(l+1,n):e[~-n]===" "?E.push(l,~-n):E.push(l,n," "))),t.removeLineBreaks||f){if(s.includes(e[n])&&ie(e,n,t.breakToTheLeftOf)){!(`\r
31
+ `:e.includes("\r")&&(I="\r"),v){for(let n=0;n<v;n++){if(t.reportProgressFunc&&(v>1e3&&v<2e3?n===ve&&t.reportProgressFunc(Math.floor((t.reportProgressFuncTo-t.reportProgressFuncFrom)/2)):v>=2e3&&(P=t.reportProgressFuncFrom+Math.floor(n/v*(se||1)),P!==q&&(q=P,t.reportProgressFunc(P)))),$++,!T&&d&&e[n]==="}"&&e[n-1]==="}"&&(i+1>=t.lineLengthLimit?(E.push(n,n,I),i=0):(h=n,p=n,y=" ")),T&&typeof T=="number"&&n>=T&&(T=void 0),D!==null&&e.startsWith("<\/script",n)&&!F(e[n+8])){if((t.removeIndentations||t.removeLineBreaks)&&n>0&&e[~-n]&&!e[~-n].trim()){for(let m=n;m--;)if(e[m]===`
32
+ `||e[m]==="\r"||e[m].trim()){m+1<n&&E.push(m+1,n);break}}D=null,T=!1,n+=8;continue}if(!T&&!d&&e.startsWith("<script",n)&&!F(e[n+7])){D=n,T=!0;let m="";(t.removeLineBreaks||t.removeIndentations)&&l!==null&&(l>0&&(m=I),E.push(l,n,m)),l=null,a=null}if(C!==null&&A===null&&!/\w/.test(e[n])){A=e.slice(C,n);let m=L(e,~-n);typeof m=="number"&&e[m]===">"&&!e[n].trim()&&L(e,n)?E.push(n,L(e,n)):m&&e[m]==="/"&&e[L(e,m)]===">"&&(!e[n].trim()&&L(e,n)&&E.push(n,L(e,n)),e[m+1]!==">"&&L(e,m+1)&&E.push(m+1,L(e,m+1)))}if(!T&&!d&&!f&&e[~-n]==="<"&&C===null&&(/\w/.test(e[n])?C=n:e[L(e,~-n)]==="/"&&/\w/.test(e[L(e,L(e,~-n))]||"")&&(C=L(e,L(e,~-n)))),!T&&(d||f)&&c!==null&&e[n]==="*"&&e[n+1]==="/"&&([h,p]=K({str:e,from:c,to:n+2,ifLeftSideIncludesThisThenCropTightly:Q||"",ifRightSideIncludesThisThenCropTightly:X||""}),c=null,h!=null?E.push(h,p):(i+=1,n+=1),T=n+2),!T&&(d||f)&&c===null&&e[n]==="/"&&e[n+1]==="*"&&(r.removeCSSComments||(r.removeCSSComments=!0),t.removeCSSComments&&(c=n)),b&&e.startsWith("![endif",n+1)&&(b=!1),!T&&!d&&!f&&O!==null){let m;e.startsWith("-->",n)?m=3:e[n]===">"&&e[n-1]==="]"&&(m=1),m&&([h,p]=K({str:e,from:O,to:n+m}),O=null,h!=null?t.lineLengthLimit&&$-(p-h)>=t.lineLengthLimit?(E.push(h,p,I),$=-m):(E.push(h,p),$-=p-h):(i+=m-1,n+=m-1),T=n+m)}if(!T&&!d&&!f&&(e.startsWith("<!--",n)||t.removeHTMLComments===2&&e.startsWith("<![endif",n))&&O===null&&(e.startsWith("[if",n+4)?(b||(b=!0),t.removeHTMLComments===2&&(O=n)):t.removeHTMLComments&&(!b||t.removeHTMLComments===2)&&(O=n),r.removeHTMLComments||(r.removeHTMLComments=!0)),!T&&d&&c===null&&e.startsWith("</style",n)&&!F(e[n+7])?d=!1:!T&&!d&&c===null&&e.startsWith("<style",n)&&!F(e[n+6])&&(d=!0,(t.removeLineBreaks||t.removeIndentations)&&t.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',n+6)&&e[n+24]&&E.push(n+23,n+23,I)),!T&&!f&&`"'`.includes(e[n])&&e.endsWith("style=",n)&&(f=n),!T&&!e[n].trim())l===null&&(l=n);else if(!T&&!((d||f)&&c!==null)){if(l!==null){if(t.removeLineBreaks&&(i+=1),_)_=!1,(t.removeIndentations||t.removeLineBreaks)&&E.push(0,n);else if(t.removeIndentations&&!t.removeLineBreaks&&(!g&&a!==null&&n>a?E.push(a+1,n):l+1<n&&(e.endsWith("]>",l)||e.endsWith("-->",l)||e.startsWith("<![",n)||e.startsWith("<!--<![",n)?E.push(l,n):e[l]===" "?E.push(l+1,n):e[~-n]===" "?E.push(l,~-n):E.push(l,n," "))),t.removeLineBreaks||f){if(s.includes(e[n])&&re(e,n,t.breakToTheLeftOf)){!(`\r
33
33
  `.includes(e[~-n])&&l===~-n)&&!(e[~-n]===`
34
- `&&e[n-2]==="\r"&&l===n-2)&&E.push(l,n,I),h=null,p=null,y=null,l=null,i=1;continue}let m=" ";e[n]==="<"&&W(e,n,t.mindTheInlineTags,{cb:H=>!H||!/\w/.test(H)})||(e[~-l]&&Le.includes(e[~-l])&&Ae.includes(e[n])||(d||f)&&c===null&&(Q.includes(e[~-l])||X.includes(e[n]))||e.startsWith("!important",n)&&!b||f&&(e[~-l]==="'"||e[~-l]==='"')||e[~-l]==="}"&&e.startsWith("</style",n)||e[n]===">"&&(`'"`.includes(e[z(e,n)])||e[L(e,n)]==="<")||e[n]==="/"&&e[L(e,n)]===">")&&(m="",e[n]==="/"&&e[n+1]===">"&&L(e,n)&&L(e,n)>n+1&&(E.push(n+1,L(e,n)),i-=L(e,n)-n+1)),d&&e[n]==="}"&&l&&e[l-1]==="}"&&(m=" "),m!=null&&m.length&&(i+=1),t.lineLengthLimit?i>=t.lineLengthLimit||!e[n+1]||e[n]===">"||e[n]==="/"&&e[n+1]===">"?((i>t.lineLengthLimit||i===t.lineLengthLimit&&e[n+1]&&e[n+1].trim()&&!j.includes(e[n])&&!U.includes(e[n+1]))&&(m=I,i=1),(i>t.lineLengthLimit||!(m===" "&&n===l+1))&&(E.push(l,n,m),a=null),h=null,p=null,y=null):(h===null||l<h)&&(h=l,p=n,y=m):n===l+1&&m===" "||E.push(l,n,m)}l=null,g||(g=!0)}else _&&(_=!1),t.removeLineBreaks&&(i+=1);g||(g=!0)}if(!T&&!_&&n!==0&&t.removeLineBreaks&&(t.lineLengthLimit||s)&&!e.startsWith("</a",n)){if(s&&ie(e,n,t.breakToTheLeftOf)&&e.slice(0,n).trim()&&(!e.startsWith("<![endif]",n)||!Te(e,n,"<!--"))){E.push(n,n,I),h=null,p=null,y=null,i=1;continue}else if(t.lineLengthLimit&&i<=t.lineLengthLimit){if(!e[n+1]||U.includes(e[n])&&!De.includes(e[n])||j.includes(e[n])||!e[n].trim()){if(h!==null&&p!==null&&(h!==p||y!=null&&y.length)){let m=y;e[n].trim()&&e[n+1]&&e[n+1].trim()&&i+(y?y.length:0)>t.lineLengthLimit&&(m=I),(i+(m?m.length:0)>t.lineLengthLimit||!(m===" "&&p===h+1&&e[h]===" "))&&(e[~-h]==="}"&&e[p]==="{"||(E.push(h,p,m),a=null))}e[n].trim()&&(U.includes(e[n])||e[~-n]&&j.includes(e[~-n]))&&S(M)&&(!A||!t.mindTheInlineTags.includes(A))&&!(e[n]==="<"&&W(e,n,t.mindTheInlineTags,{cb:m=>!m||!/\w/.test(m)}))&&!(e[n]==="<"&&W(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:m=>!m||!/\w/.test(m)}))?(h=n,p=n,y=null):c===null&&h!==null&&(f||!t.mindTheInlineTags||!Array.isArray(t.mindTheInlineTags)||Array.isArray(t.mindTheInlineTags.length)&&!t.mindTheInlineTags.length||!S(A)||Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&S(A)&&!t.mindTheInlineTags.includes(A))&&!(e[n]==="<"&&W(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:m=>!m||!/\w/.test(m)}))&&(h=null,p=null,y=null)}}else if(t.lineLengthLimit)if(U.includes(e[n])&&!(e[n]==="<"&&W(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:m=>!m||!/\w/.test(m)})))if(h!==null&&p!==null&&(h!==p||y!=null&&y.length)){let m=y!=null&&y.length?y.length:0;i-(p-h-m)-1>t.lineLengthLimit||(E.push(h,p,y),i-(p-h-m)-1===t.lineLengthLimit&&(E.push(n,n,I),i=0),h=null,p=null,y=null)}else E.push(n,n,I),i=0;else e[n+1]&&j.includes(e[n])&&S(A)&&Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&!t.mindTheInlineTags.includes(A)?h!==null&&p!==null&&(h!==p||y!=null&&y.length)||(E.push(n+1,n+1,I),i=0):e[n].trim()&&(e[n+1]||h!==null&&p!==null&&(h!==p||y!=null&&y.length)&&E.push(h,p,I))}if(!T&&!_&&t.removeLineBreaks&&t.lineLengthLimit&&i>=t.lineLengthLimit&&h!==null&&p!==null&&!j.includes(e[n])&&!U.includes(e[n])&&!"/".includes(e[n])&&!(i===t.lineLengthLimit&&e[n+1]&&!e[n+1].trim())){let m=I;e[n+1]&&!e[n+1].trim()&&i===t.lineLengthLimit&&(m=y),m===I&&!e[~-h].trim()&&z(e,h)&&(h=z(e,h)+1),E.push(h,p,m),i=n-p,e[n].length&&(i+=1),h=null,p=null,y=null}if((!T&&e[n]===`
34
+ `&&e[n-2]==="\r"&&l===n-2)&&E.push(l,n,I),h=null,p=null,y=null,l=null,i=1;continue}let m=" ";e[n]==="<"&&J(e,n,t.mindTheInlineTags,{cb:H=>!H||!/\w/.test(H)})||(e[~-l]&&Ie.includes(e[~-l])&&Ce.includes(e[n])||(d||f)&&c===null&&(Q.includes(e[~-l])||X.includes(e[n]))||e.startsWith("!important",n)&&!b||f&&(e[~-l]==="'"||e[~-l]==='"')||e[~-l]==="}"&&e.startsWith("</style",n)||e[n]===">"&&(`'"`.includes(e[z(e,n)])||e[L(e,n)]==="<")||e[n]==="/"&&e[L(e,n)]===">")&&(m="",e[n]==="/"&&e[n+1]===">"&&L(e,n)&&L(e,n)>n+1&&(E.push(n+1,L(e,n)),i-=L(e,n)-n+1)),d&&e[n]==="}"&&l&&e[l-1]==="}"&&(m=" "),m!=null&&m.length&&(i+=1),t.lineLengthLimit?i>=t.lineLengthLimit||!e[n+1]||e[n]===">"||e[n]==="/"&&e[n+1]===">"?((i>t.lineLengthLimit||i===t.lineLengthLimit&&e[n+1]&&e[n+1].trim()&&!j.includes(e[n])&&!U.includes(e[n+1]))&&(m=I,i=1),(i>t.lineLengthLimit||!(m===" "&&n===l+1))&&(E.push(l,n,m),a=null),h=null,p=null,y=null):(h===null||l<h)&&(h=l,p=n,y=m):n===l+1&&m===" "||E.push(l,n,m)}l=null,g||(g=!0)}else _&&(_=!1),t.removeLineBreaks&&(i+=1);g||(g=!0)}if(!T&&!_&&n!==0&&t.removeLineBreaks&&(t.lineLengthLimit||s)&&!e.startsWith("</a",n)){if(s&&re(e,n,t.breakToTheLeftOf)&&e.slice(0,n).trim()&&(!e.startsWith("<![endif]",n)||!we(e,n,"<!--"))){E.push(n,n,I),h=null,p=null,y=null,i=1;continue}else if(t.lineLengthLimit&&i<=t.lineLengthLimit){if(!e[n+1]||U.includes(e[n])&&!Ae.includes(e[n])||j.includes(e[n])||!e[n].trim()){if(h!==null&&p!==null&&(h!==p||y!=null&&y.length)){let m=y;e[n].trim()&&e[n+1]&&e[n+1].trim()&&i+(y?y.length:0)>t.lineLengthLimit&&(m=I),(i+(m?m.length:0)>t.lineLengthLimit||!(m===" "&&p===h+1&&e[h]===" "))&&(e[~-h]==="}"&&e[p]==="{"||(E.push(h,p,m),a=null))}e[n].trim()&&(U.includes(e[n])||e[~-n]&&j.includes(e[~-n]))&&S(M)&&(!A||!t.mindTheInlineTags.includes(A))&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{cb:m=>!m||!/\w/.test(m)}))&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:m=>!m||!/\w/.test(m)}))?(h=n,p=n,y=null):c===null&&h!==null&&(f||!t.mindTheInlineTags||!Array.isArray(t.mindTheInlineTags)||Array.isArray(t.mindTheInlineTags.length)&&!t.mindTheInlineTags.length||!S(A)||Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&S(A)&&!t.mindTheInlineTags.includes(A))&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:m=>!m||!/\w/.test(m)}))&&(h=null,p=null,y=null)}}else if(t.lineLengthLimit)if(U.includes(e[n])&&!(e[n]==="<"&&J(e,n,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:m=>!m||!/\w/.test(m)})))if(h!==null&&p!==null&&(h!==p||y!=null&&y.length)){let m=y!=null&&y.length?y.length:0;i-(p-h-m)-1>t.lineLengthLimit||(E.push(h,p,y),i-(p-h-m)-1===t.lineLengthLimit&&(E.push(n,n,I),i=0),h=null,p=null,y=null)}else E.push(n,n,I),i=0;else e[n+1]&&j.includes(e[n])&&S(A)&&Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&!t.mindTheInlineTags.includes(A)?h!==null&&p!==null&&(h!==p||y!=null&&y.length)||(E.push(n+1,n+1,I),i=0):e[n].trim()&&(e[n+1]||h!==null&&p!==null&&(h!==p||y!=null&&y.length)&&E.push(h,p,I))}if(!T&&!_&&t.removeLineBreaks&&t.lineLengthLimit&&i>=t.lineLengthLimit&&h!==null&&p!==null&&!j.includes(e[n])&&!U.includes(e[n])&&!"/".includes(e[n])&&!(i===t.lineLengthLimit&&e[n+1]&&!e[n+1].trim())){let m=I;e[n+1]&&!e[n+1].trim()&&i===t.lineLengthLimit&&(m=y),m===I&&!e[~-h].trim()&&z(e,h)&&(h=z(e,h)+1),E.push(h,p,m),i=n-p,e[n].length&&(i+=1),h=null,p=null,y=null}if((!T&&e[n]===`
35
35
  `||e[n]==="\r"&&(!e[n+1]||e[n+1]&&e[n+1]!==`
36
36
  `))&&(a=n,g&&(g=!1),!t.removeLineBreaks&&l!==null&&l<n&&e[n+1]&&e[n+1]!=="\r"&&e[n+1]!==`
37
37
  `&&E.push(l,n)),e[n+1]||(d&&c!==null?E.push([...K({str:e,from:c,to:n,ifLeftSideIncludesThisThenCropTightly:Q||"",ifRightSideIncludesThisThenCropTightly:X||""})]):l&&e[n]!==`
38
38
  `&&e[n]!=="\r"?E.push(l,n+1):l&&(e[n]==="\r"&&e[n+1]===`
39
39
  `||e[n]===`
40
- `&&e[n-1]!=="\r")&&E.push(l,n)),!T&&f&&f<n&&e[f]===e[n]&&(f=null),!T&&!d&&e.startsWith("<pre",n)&&!F(e[n+4])){let m=e.indexOf("</pre",n+5);m>0&&(T=m)}if(!T&&!d&&e.startsWith("<code",n)&&!F(e[n+5])){let m=e.indexOf("</code",n+5);m>0&&(T=m)}if(!T&&e.startsWith("<![CDATA[",n)){let m=e.indexOf("]]>",n+9);m>0&&(T=m)}!T&&!d&&!f&&C!==null&&e[n]===">"&&(e[L(e,n)]==="<"&&(M=A),C=null,A=null),e[n]==="<"&&M!==null&&(M=null),d&&e[n]==="{"&&e[n+1]==="{"&&e.indexOf("}}")!==-1&&(T=e.indexOf("}}")+2);let k=!0}if(E.current()){let n=E.current();E.wipe();let k=t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*oe,m=$e(e,n,Ce=>{t.reportProgressFunc&&v>=2e3&&(P=Math.floor(k+(t.reportProgressFuncTo-k)*(Ce/100)),P!==q&&(q=P,t.reportProgressFunc(P)))}),H=m.length;return{log:{timeTakenInMilliseconds:Date.now()-u,originalLength:v,cleanedLength:H,bytesSaved:Math.max(v-H,0),percentageReducedOfOriginal:v?Math.round(Math.max(v-H,0)*100/v):0},ranges:n,applicableOpts:r,result:m}}}return{log:{timeTakenInMilliseconds:Date.now()-u,originalLength:v,cleanedLength:v,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:r,ranges:null,result:e}}return He(Ze);})();
40
+ `&&e[n-1]!=="\r")&&E.push(l,n)),!T&&f&&f<n&&e[f]===e[n]&&(f=null),!T&&!d&&e.startsWith("<pre",n)&&!F(e[n+4])){let m=e.indexOf("</pre",n+5);m>0&&(T=m)}if(!T&&!d&&e.startsWith("<code",n)&&!F(e[n+5])){let m=e.indexOf("</code",n+5);m>0&&(T=m)}if(!T&&e.startsWith("<![CDATA[",n)){let m=e.indexOf("]]>",n+9);m>0&&(T=m)}!T&&!d&&!f&&C!==null&&e[n]===">"&&(e[L(e,n)]==="<"&&(M=A),C=null,A=null),e[n]==="<"&&M!==null&&(M=null),d&&e[n]==="{"&&e[n+1]==="{"&&e.indexOf("}}")!==-1&&(T=e.indexOf("}}")+2);let k=!0}if(E.current()){let n=E.current();E.wipe();let k=t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*le,m=ce(e,n,Ne=>{t.reportProgressFunc&&v>=2e3&&(P=Math.floor(k+(t.reportProgressFuncTo-k)*(Ne/100)),P!==q&&(q=P,t.reportProgressFunc(P)))}),H=m.length;return{log:{timeTakenInMilliseconds:Date.now()-u,originalLength:v,cleanedLength:H,bytesSaved:Math.max(v-H,0),percentageReducedOfOriginal:v?Math.round(Math.max(v-H,0)*100/v):0},ranges:n,applicableOpts:r,result:m}}}return{log:{timeTakenInMilliseconds:Date.now()-u,originalLength:v,cleanedLength:v,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:r,ranges:null,result:e}}return xe(et);})();
41
41
  /**
42
42
  * @name ranges-sort
43
43
  * @fileoverview Sort string index ranges
@@ -49,7 +49,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
49
49
  /**
50
50
  * @name ranges-merge
51
51
  * @fileoverview Merge and sort string index ranges
52
- * @version 9.0.9
52
+ * @version 9.0.10
53
53
  * @author Roy Revelt, Codsen Ltd
54
54
  * @license MIT
55
55
  * {@link https://codsen.com/os/ranges-merge/}
@@ -57,7 +57,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
57
57
  /**
58
58
  * @name ranges-apply
59
59
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
60
- * @version 7.0.9
60
+ * @version 7.0.10
61
61
  * @author Roy Revelt, Codsen Ltd
62
62
  * @license MIT
63
63
  * {@link https://codsen.com/os/ranges-apply/}
@@ -73,7 +73,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
73
73
  /**
74
74
  * @name codsen-utils
75
75
  * @fileoverview Various utility functions
76
- * @version 1.5.0
76
+ * @version 1.6.0
77
77
  * @author Roy Revelt, Codsen Ltd
78
78
  * @license MIT
79
79
  * {@link https://codsen.com/os/codsen-utils/}
@@ -81,7 +81,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
81
81
  /**
82
82
  * @name ranges-push
83
83
  * @fileoverview Gather string index ranges
84
- * @version 7.0.9
84
+ * @version 7.0.10
85
85
  * @author Roy Revelt, Codsen Ltd
86
86
  * @license MIT
87
87
  * {@link https://codsen.com/os/ranges-push/}
@@ -97,7 +97,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
97
97
  /**
98
98
  * @name string-match-left-right
99
99
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
100
- * @version 9.0.12
100
+ * @version 9.0.13
101
101
  * @author Roy Revelt, Codsen Ltd
102
102
  * @license MIT
103
103
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -105,7 +105,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
105
105
  /**
106
106
  * @name string-range-expander
107
107
  * @fileoverview Expands string index ranges within whitespace boundaries until letters are met
108
- * @version 4.0.9
108
+ * @version 4.0.10
109
109
  * @author Roy Revelt, Codsen Ltd
110
110
  * @license MIT
111
111
  * {@link https://codsen.com/os/string-range-expander/}
@@ -113,7 +113,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Oe),o);typeof t.r
113
113
  /**
114
114
  * @name string-left-right
115
115
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
116
- * @version 6.0.12
116
+ * @version 6.0.13
117
117
  * @author Roy Revelt, Codsen Ltd
118
118
  * @license MIT
119
119
  * {@link https://codsen.com/os/string-left-right/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-crush",
3
- "version": "6.0.12",
3
+ "version": "6.0.13",
4
4
  "description": "Minify email templates",
5
5
  "keywords": [
6
6
  "breaks",
@@ -80,12 +80,12 @@
80
80
  }
81
81
  },
82
82
  "dependencies": {
83
- "codsen-utils": "^1.5.0",
84
- "ranges-apply": "^7.0.9",
85
- "ranges-push": "^7.0.9",
86
- "string-left-right": "^6.0.12",
87
- "string-match-left-right": "^9.0.12",
88
- "string-range-expander": "^4.0.9",
89
- "test-mixer": "^4.1.9"
83
+ "codsen-utils": "^1.6.0",
84
+ "ranges-apply": "^7.0.10",
85
+ "ranges-push": "^7.0.10",
86
+ "string-left-right": "^6.0.13",
87
+ "string-match-left-right": "^9.0.13",
88
+ "string-range-expander": "^4.0.10",
89
+ "test-mixer": "^4.1.10"
90
90
  }
91
91
  }