html-crush 6.0.4 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-crush.esm.js +2 -2
- package/dist/html-crush.umd.js +17 -17
- package/package.json +4 -4
package/dist/html-crush.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name html-crush
|
|
3
3
|
* @fileoverview Minify email templates
|
|
4
|
-
* @version 6.0.
|
|
4
|
+
* @version 6.0.6
|
|
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";var Y="6.0.
|
|
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";var Y="6.0.6";var ge=Y,$=new le({limitToBeAddedWhitespace:!0}),te={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 y(n){return typeof n=="string"}function A(n){return typeof n=="string"&&n.toUpperCase()!==n.toLowerCase()}function ce(n,E){let x=Date.now();if(!y(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&&typeof E!="object")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(!y(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={...te,...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
|
package/dist/html-crush.umd.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name html-crush
|
|
3
3
|
* @fileoverview Minify email templates
|
|
4
|
-
* @version 6.0.
|
|
4
|
+
* @version 6.0.6
|
|
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 zt=Object.create;var ee=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,tn=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var ye=(e,t,r)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))Ue.call(t,r)&&ye(e,r,t[r]);if(ke)for(var r of ke(t))nn.call(t,r)&&ye(e,r,t[r]);return e};var rn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),on=(e,t)=>{for(var r in t)ee(e,r,{get:t[r],enumerable:!0})},Be=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of en(t))!Ue.call(e,a)&&a!==r&&ee(e,a,{get:()=>t[a],enumerable:!(n=Zt(t,a))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?zt(tn(e)):{},Be(t||!e||!e.__esModule?ee(r,"default",{value:e,enumerable:!0}):r,e)),ln=e=>Be(ee({},"__esModule",{value:!0}),e);var Ee=(e,t,r)=>(ye(e,typeof t!="symbol"?t+"":t,r),r);var Ut=rn((ne,U)=>{var pn=200,ht="__lodash_hash_undefined__",$t=9007199254740991,Ve="[object Arguments]",dn="[object Array]",pt="[object Boolean]",dt="[object Date]",bn="[object Error]",Re="[object Function]",bt="[object GeneratorFunction]",ue="[object Map]",Tt="[object Number]",Me="[object Object]",rt="[object Promise]",yt="[object RegExp]",ge="[object Set]",Et="[object String]",St="[object Symbol]",Ce="[object WeakMap]",Ot="[object ArrayBuffer]",ce="[object DataView]",wt="[object Float32Array]",Lt="[object Float64Array]",Dt="[object Int8Array]",Ct="[object Int16Array]",At="[object Int32Array]",It="[object Uint8Array]",vt="[object Uint8ClampedArray]",Nt="[object Uint16Array]",_t="[object Uint32Array]",Tn=/[\\^$.*+?()[\]{}|]/g,yn=/\w*$/,En=/^\[object .+?Constructor\]$/,Sn=/^(?:0|[1-9]\d*)$/,O={};O[Ve]=O[dn]=O[Ot]=O[ce]=O[pt]=O[dt]=O[wt]=O[Lt]=O[Dt]=O[Ct]=O[At]=O[ue]=O[Tt]=O[Me]=O[yt]=O[ge]=O[Et]=O[St]=O[It]=O[vt]=O[Nt]=O[_t]=!0;O[bn]=O[Re]=O[Ce]=!1;var On=typeof global=="object"&&global&&global.Object===Object&&global,wn=typeof self=="object"&&self&&self.Object===Object&&self,N=On||wn||Function("return this")(),Vt=typeof ne=="object"&&ne&&!ne.nodeType&&ne,it=Vt&&typeof U=="object"&&U&&!U.nodeType&&U,Ln=it&&it.exports===Vt;function Dn(e,t){return e.set(t[0],t[1]),e}function Cn(e,t){return e.add(t),e}function An(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function In(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function Rt(e,t,r,n){var a=-1,o=e?e.length:0;for(n&&o&&(r=e[++a]);++a<o;)r=t(r,e[a],a,e);return r}function vn(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Nn(e,t){return e==null?void 0:e[t]}function Mt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function ot(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}function Pe(e,t){return function(r){return e(t(r))}}function st(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var _n=Array.prototype,Vn=Function.prototype,fe=Object.prototype,De=N["__core-js_shared__"],lt=function(){var e=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Pt=Vn.toString,x=fe.hasOwnProperty,me=fe.toString,Rn=RegExp("^"+Pt.call(x).replace(Tn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),at=Ln?N.Buffer:void 0,ut=N.Symbol,gt=N.Uint8Array,Mn=Pe(Object.getPrototypeOf,Object),Pn=Object.create,xn=fe.propertyIsEnumerable,Hn=_n.splice,ct=Object.getOwnPropertySymbols,Fn=at?at.isBuffer:void 0,Wn=Pe(Object.keys,Object),Ae=q(N,"DataView"),re=q(N,"Map"),Ie=q(N,"Promise"),ve=q(N,"Set"),Ne=q(N,"WeakMap"),ie=q(Object,"create"),Jn=W(Ae),jn=W(re),kn=W(Ie),Un=W(ve),Bn=W(Ne),ft=ut?ut.prototype:void 0,mt=ft?ft.valueOf:void 0;function F(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gn(){this.__data__=ie?ie(null):{}}function qn(e){return this.has(e)&&delete this.__data__[e]}function Kn(e){var t=this.__data__;if(ie){var r=t[e];return r===ht?void 0:r}return x.call(t,e)?t[e]:void 0}function Yn(e){var t=this.__data__;return ie?t[e]!==void 0:x.call(t,e)}function Xn(e,t){var r=this.__data__;return r[e]=ie&&t===void 0?ht:t,this}F.prototype.clear=Gn;F.prototype.delete=qn;F.prototype.get=Kn;F.prototype.has=Yn;F.prototype.set=Xn;function _(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Qn(){this.__data__=[]}function zn(e){var t=this.__data__,r=he(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Hn.call(t,r,1),!0}function Zn(e){var t=this.__data__,r=he(t,e);return r<0?void 0:t[r][1]}function er(e){return he(this.__data__,e)>-1}function tr(e,t){var r=this.__data__,n=he(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}_.prototype.clear=Qn;_.prototype.delete=zn;_.prototype.get=Zn;_.prototype.has=er;_.prototype.set=tr;function B(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function nr(){this.__data__={hash:new F,map:new(re||_),string:new F}}function rr(e){return $e(this,e).delete(e)}function ir(e){return $e(this,e).get(e)}function or(e){return $e(this,e).has(e)}function sr(e,t){return $e(this,e).set(e,t),this}B.prototype.clear=nr;B.prototype.delete=rr;B.prototype.get=ir;B.prototype.has=or;B.prototype.set=sr;function G(e){this.__data__=new _(e)}function lr(){this.__data__=new _}function ar(e){return this.__data__.delete(e)}function ur(e){return this.__data__.get(e)}function gr(e){return this.__data__.has(e)}function cr(e,t){var r=this.__data__;if(r instanceof _){var n=r.__data__;if(!re||n.length<pn-1)return n.push([e,t]),this;r=this.__data__=new B(n)}return r.set(e,t),this}G.prototype.clear=lr;G.prototype.delete=ar;G.prototype.get=ur;G.prototype.has=gr;G.prototype.set=cr;function fr(e,t){var r=He(e)||Pr(e)?vn(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||x.call(e,o))&&!(a&&(o=="length"||_r(o,n)))&&r.push(o);return r}function xt(e,t,r){var n=e[t];(!(x.call(e,t)&&Jt(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function he(e,t){for(var r=e.length;r--;)if(Jt(e[r][0],t))return r;return-1}function mr(e,t){return e&&Ht(t,Fe(t),e)}function _e(e,t,r,n,a,o,u){var l;if(n&&(l=o?n(e,a,o,u):n(e)),l!==void 0)return l;if(!pe(e))return e;var c=He(e);if(c){if(l=Ir(e),!t)return Dr(e,l)}else{var s=H(e),d=s==Re||s==bt;if(Hr(e))return Tr(e,t);if(s==Me||s==Ve||d&&!o){if(Mt(e))return o?e:{};if(l=vr(d?{}:e),!t)return Cr(e,mr(l,e))}else{if(!O[s])return o?e:{};l=Nr(e,s,_e,t)}}u||(u=new G);var p=u.get(e);if(p)return p;if(u.set(e,l),!c)var T=r?Ar(e):Fe(e);return An(T||e,function(f,m){T&&(m=f,f=e[m]),xt(l,m,_e(f,t,r,n,m,e,u))}),l}function hr(e){return pe(e)?Pn(e):{}}function $r(e,t,r){var n=t(e);return He(e)?n:In(n,r(e))}function pr(e){return me.call(e)}function dr(e){if(!pe(e)||Rr(e))return!1;var t=kt(e)||Mt(e)?Rn:En;return t.test(W(e))}function br(e){if(!Wt(e))return Wn(e);var t=[];for(var r in Object(e))x.call(e,r)&&r!="constructor"&&t.push(r);return t}function Tr(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function xe(e){var t=new e.constructor(e.byteLength);return new gt(t).set(new gt(e)),t}function yr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Er(e,t,r){var n=t?r(ot(e),!0):ot(e);return Rt(n,Dn,new e.constructor)}function Sr(e){var t=new e.constructor(e.source,yn.exec(e));return t.lastIndex=e.lastIndex,t}function Or(e,t,r){var n=t?r(st(e),!0):st(e);return Rt(n,Cn,new e.constructor)}function wr(e){return mt?Object(mt.call(e)):{}}function Lr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Dr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function Ht(e,t,r,n){r||(r={});for(var a=-1,o=t.length;++a<o;){var u=t[a],l=n?n(r[u],e[u],u,r,e):void 0;xt(r,u,l===void 0?e[u]:l)}return r}function Cr(e,t){return Ht(e,Ft(e),t)}function Ar(e){return $r(e,Fe,Ft)}function $e(e,t){var r=e.__data__;return Vr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function q(e,t){var r=Nn(e,t);return dr(r)?r:void 0}var Ft=ct?Pe(ct,Object):Jr,H=pr;(Ae&&H(new Ae(new ArrayBuffer(1)))!=ce||re&&H(new re)!=ue||Ie&&H(Ie.resolve())!=rt||ve&&H(new ve)!=ge||Ne&&H(new Ne)!=Ce)&&(H=function(e){var t=me.call(e),r=t==Me?e.constructor:void 0,n=r?W(r):void 0;if(n)switch(n){case Jn:return ce;case jn:return ue;case kn:return rt;case Un:return ge;case Bn:return Ce}return t});function Ir(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&x.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function vr(e){return typeof e.constructor=="function"&&!Wt(e)?hr(Mn(e)):{}}function Nr(e,t,r,n){var a=e.constructor;switch(t){case Ot:return xe(e);case pt:case dt:return new a(+e);case ce:return yr(e,n);case wt:case Lt:case Dt:case Ct:case At:case It:case vt:case Nt:case _t:return Lr(e,n);case ue:return Er(e,n,r);case Tt:case Et:return new a(e);case yt:return Sr(e);case ge:return Or(e,n,r);case St:return wr(e)}}function _r(e,t){return t=t==null?$t:t,!!t&&(typeof e=="number"||Sn.test(e))&&e>-1&&e%1==0&&e<t}function Vr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Rr(e){return!!lt&< in e}function Wt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fe;return e===r}function W(e){if(e!=null){try{return Pt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Mr(e){return _e(e,!0,!0)}function Jt(e,t){return e===t||e!==e&&t!==t}function Pr(e){return xr(e)&&x.call(e,"callee")&&(!xn.call(e,"callee")||me.call(e)==Ve)}var He=Array.isArray;function jt(e){return e!=null&&Fr(e.length)&&!kt(e)}function xr(e){return Wr(e)&&jt(e)}var Hr=Fn||jr;function kt(e){var t=pe(e)?me.call(e):"";return t==Re||t==bt}function Fr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$t}function pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Wr(e){return!!e&&typeof e=="object"}function Fe(e){return jt(e)?fr(e):br(e)}function Jr(){return[]}function jr(){return!1}U.exports=Mr});var Yr={};on(Yr,{crush:()=>Kr,defaults:()=>Gt,version:()=>qr});var an={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Se(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},an),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,c)=>!Array.isArray(l)||l.length!==2?(n=c,a=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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${a} elements!`);if(!e.every((l,c)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(n=c,!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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let o=e.length**2,u=0;return Array.from(e).sort((l,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===c[0]?l[1]<c[1]?-1:l[1]>c[1]?1:0:l[0]<c[0]?-1:1))}var Ge={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qe(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Ge),t),n.progressFn&&r(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.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 n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
|
|
10
|
+
"use strict";var htmlCrush=(()=>{var zt=Object.create;var ee=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,tn=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var ye=(e,t,r)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))je.call(t,r)&&ye(e,r,t[r]);if(ke)for(var r of ke(t))nn.call(t,r)&&ye(e,r,t[r]);return e};var rn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),on=(e,t)=>{for(var r in t)ee(e,r,{get:t[r],enumerable:!0})},Ue=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of en(t))!je.call(e,a)&&a!==r&&ee(e,a,{get:()=>t[a],enumerable:!(n=Zt(t,a))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?zt(tn(e)):{},Ue(t||!e||!e.__esModule?ee(r,"default",{value:e,enumerable:!0}):r,e)),ln=e=>Ue(ee({},"__esModule",{value:!0}),e);var Ee=(e,t,r)=>(ye(e,typeof t!="symbol"?t+"":t,r),r);var jt=rn((ne,j)=>{var pn=200,ht="__lodash_hash_undefined__",$t=9007199254740991,Re="[object Arguments]",dn="[object Array]",pt="[object Boolean]",dt="[object Date]",bn="[object Error]",Ve="[object Function]",bt="[object GeneratorFunction]",ue="[object Map]",Tt="[object Number]",Me="[object Object]",rt="[object Promise]",yt="[object RegExp]",ge="[object Set]",Et="[object String]",St="[object Symbol]",De="[object WeakMap]",Ot="[object ArrayBuffer]",ce="[object DataView]",wt="[object Float32Array]",Lt="[object Float64Array]",At="[object Int8Array]",Dt="[object Int16Array]",Ct="[object Int32Array]",It="[object Uint8Array]",vt="[object Uint8ClampedArray]",Nt="[object Uint16Array]",_t="[object Uint32Array]",Tn=/[\\^$.*+?()[\]{}|]/g,yn=/\w*$/,En=/^\[object .+?Constructor\]$/,Sn=/^(?:0|[1-9]\d*)$/,O={};O[Re]=O[dn]=O[Ot]=O[ce]=O[pt]=O[dt]=O[wt]=O[Lt]=O[At]=O[Dt]=O[Ct]=O[ue]=O[Tt]=O[Me]=O[yt]=O[ge]=O[Et]=O[St]=O[It]=O[vt]=O[Nt]=O[_t]=!0;O[bn]=O[Ve]=O[De]=!1;var On=typeof global=="object"&&global&&global.Object===Object&&global,wn=typeof self=="object"&&self&&self.Object===Object&&self,N=On||wn||Function("return this")(),Rt=typeof ne=="object"&&ne&&!ne.nodeType&&ne,it=Rt&&typeof j=="object"&&j&&!j.nodeType&&j,Ln=it&&it.exports===Rt;function An(e,t){return e.set(t[0],t[1]),e}function Dn(e,t){return e.add(t),e}function Cn(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function In(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function Vt(e,t,r,n){var a=-1,o=e?e.length:0;for(n&&o&&(r=e[++a]);++a<o;)r=t(r,e[a],a,e);return r}function vn(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Nn(e,t){return e==null?void 0:e[t]}function Mt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function ot(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}function Pe(e,t){return function(r){return e(t(r))}}function st(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var _n=Array.prototype,Rn=Function.prototype,fe=Object.prototype,Ae=N["__core-js_shared__"],lt=function(){var e=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Pt=Rn.toString,x=fe.hasOwnProperty,me=fe.toString,Vn=RegExp("^"+Pt.call(x).replace(Tn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),at=Ln?N.Buffer:void 0,ut=N.Symbol,gt=N.Uint8Array,Mn=Pe(Object.getPrototypeOf,Object),Pn=Object.create,xn=fe.propertyIsEnumerable,Fn=_n.splice,ct=Object.getOwnPropertySymbols,Hn=at?at.isBuffer:void 0,Wn=Pe(Object.keys,Object),Ce=q(N,"DataView"),re=q(N,"Map"),Ie=q(N,"Promise"),ve=q(N,"Set"),Ne=q(N,"WeakMap"),ie=q(Object,"create"),Jn=W(Ce),Bn=W(re),kn=W(Ie),jn=W(ve),Un=W(Ne),ft=ut?ut.prototype:void 0,mt=ft?ft.valueOf:void 0;function H(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gn(){this.__data__=ie?ie(null):{}}function qn(e){return this.has(e)&&delete this.__data__[e]}function Kn(e){var t=this.__data__;if(ie){var r=t[e];return r===ht?void 0:r}return x.call(t,e)?t[e]:void 0}function Yn(e){var t=this.__data__;return ie?t[e]!==void 0:x.call(t,e)}function Qn(e,t){var r=this.__data__;return r[e]=ie&&t===void 0?ht:t,this}H.prototype.clear=Gn;H.prototype.delete=qn;H.prototype.get=Kn;H.prototype.has=Yn;H.prototype.set=Qn;function _(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Xn(){this.__data__=[]}function zn(e){var t=this.__data__,r=he(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Fn.call(t,r,1),!0}function Zn(e){var t=this.__data__,r=he(t,e);return r<0?void 0:t[r][1]}function er(e){return he(this.__data__,e)>-1}function tr(e,t){var r=this.__data__,n=he(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}_.prototype.clear=Xn;_.prototype.delete=zn;_.prototype.get=Zn;_.prototype.has=er;_.prototype.set=tr;function U(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function nr(){this.__data__={hash:new H,map:new(re||_),string:new H}}function rr(e){return $e(this,e).delete(e)}function ir(e){return $e(this,e).get(e)}function or(e){return $e(this,e).has(e)}function sr(e,t){return $e(this,e).set(e,t),this}U.prototype.clear=nr;U.prototype.delete=rr;U.prototype.get=ir;U.prototype.has=or;U.prototype.set=sr;function G(e){this.__data__=new _(e)}function lr(){this.__data__=new _}function ar(e){return this.__data__.delete(e)}function ur(e){return this.__data__.get(e)}function gr(e){return this.__data__.has(e)}function cr(e,t){var r=this.__data__;if(r instanceof _){var n=r.__data__;if(!re||n.length<pn-1)return n.push([e,t]),this;r=this.__data__=new U(n)}return r.set(e,t),this}G.prototype.clear=lr;G.prototype.delete=ar;G.prototype.get=ur;G.prototype.has=gr;G.prototype.set=cr;function fr(e,t){var r=Fe(e)||Pr(e)?vn(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||x.call(e,o))&&!(a&&(o=="length"||_r(o,n)))&&r.push(o);return r}function xt(e,t,r){var n=e[t];(!(x.call(e,t)&&Jt(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function he(e,t){for(var r=e.length;r--;)if(Jt(e[r][0],t))return r;return-1}function mr(e,t){return e&&Ft(t,He(t),e)}function _e(e,t,r,n,a,o,u){var l;if(n&&(l=o?n(e,a,o,u):n(e)),l!==void 0)return l;if(!pe(e))return e;var c=Fe(e);if(c){if(l=Ir(e),!t)return Ar(e,l)}else{var s=F(e),d=s==Ve||s==bt;if(Fr(e))return Tr(e,t);if(s==Me||s==Re||d&&!o){if(Mt(e))return o?e:{};if(l=vr(d?{}:e),!t)return Dr(e,mr(l,e))}else{if(!O[s])return o?e:{};l=Nr(e,s,_e,t)}}u||(u=new G);var p=u.get(e);if(p)return p;if(u.set(e,l),!c)var T=r?Cr(e):He(e);return Cn(T||e,function(f,m){T&&(m=f,f=e[m]),xt(l,m,_e(f,t,r,n,m,e,u))}),l}function hr(e){return pe(e)?Pn(e):{}}function $r(e,t,r){var n=t(e);return Fe(e)?n:In(n,r(e))}function pr(e){return me.call(e)}function dr(e){if(!pe(e)||Vr(e))return!1;var t=kt(e)||Mt(e)?Vn:En;return t.test(W(e))}function br(e){if(!Wt(e))return Wn(e);var t=[];for(var r in Object(e))x.call(e,r)&&r!="constructor"&&t.push(r);return t}function Tr(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function xe(e){var t=new e.constructor(e.byteLength);return new gt(t).set(new gt(e)),t}function yr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Er(e,t,r){var n=t?r(ot(e),!0):ot(e);return Vt(n,An,new e.constructor)}function Sr(e){var t=new e.constructor(e.source,yn.exec(e));return t.lastIndex=e.lastIndex,t}function Or(e,t,r){var n=t?r(st(e),!0):st(e);return Vt(n,Dn,new e.constructor)}function wr(e){return mt?Object(mt.call(e)):{}}function Lr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ar(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function Ft(e,t,r,n){r||(r={});for(var a=-1,o=t.length;++a<o;){var u=t[a],l=n?n(r[u],e[u],u,r,e):void 0;xt(r,u,l===void 0?e[u]:l)}return r}function Dr(e,t){return Ft(e,Ht(e),t)}function Cr(e){return $r(e,He,Ht)}function $e(e,t){var r=e.__data__;return Rr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function q(e,t){var r=Nn(e,t);return dr(r)?r:void 0}var Ht=ct?Pe(ct,Object):Jr,F=pr;(Ce&&F(new Ce(new ArrayBuffer(1)))!=ce||re&&F(new re)!=ue||Ie&&F(Ie.resolve())!=rt||ve&&F(new ve)!=ge||Ne&&F(new Ne)!=De)&&(F=function(e){var t=me.call(e),r=t==Me?e.constructor:void 0,n=r?W(r):void 0;if(n)switch(n){case Jn:return ce;case Bn:return ue;case kn:return rt;case jn:return ge;case Un:return De}return t});function Ir(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&x.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function vr(e){return typeof e.constructor=="function"&&!Wt(e)?hr(Mn(e)):{}}function Nr(e,t,r,n){var a=e.constructor;switch(t){case Ot:return xe(e);case pt:case dt:return new a(+e);case ce:return yr(e,n);case wt:case Lt:case At:case Dt:case Ct:case It:case vt:case Nt:case _t:return Lr(e,n);case ue:return Er(e,n,r);case Tt:case Et:return new a(e);case yt:return Sr(e);case ge:return Or(e,n,r);case St:return wr(e)}}function _r(e,t){return t=t==null?$t:t,!!t&&(typeof e=="number"||Sn.test(e))&&e>-1&&e%1==0&&e<t}function Rr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Vr(e){return!!lt&< in e}function Wt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fe;return e===r}function W(e){if(e!=null){try{return Pt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Mr(e){return _e(e,!0,!0)}function Jt(e,t){return e===t||e!==e&&t!==t}function Pr(e){return xr(e)&&x.call(e,"callee")&&(!xn.call(e,"callee")||me.call(e)==Re)}var Fe=Array.isArray;function Bt(e){return e!=null&&Hr(e.length)&&!kt(e)}function xr(e){return Wr(e)&&Bt(e)}var Fr=Hn||Br;function kt(e){var t=pe(e)?me.call(e):"";return t==Ve||t==bt}function Hr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$t}function pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Wr(e){return!!e&&typeof e=="object"}function He(e){return Bt(e)?fr(e):br(e)}function Jr(){return[]}function Br(){return!1}j.exports=Mr});var Yr={};on(Yr,{crush:()=>Kr,defaults:()=>Gt,version:()=>qr});var an={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Se(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},an),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,c)=>!Array.isArray(l)||l.length!==2?(n=c,a=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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${a} elements!`);if(!e.every((l,c)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(n=c,!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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let o=e.length**2,u=0;return Array.from(e).sort((l,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===c[0]?l[1]<c[1]?-1:l[1]>c[1]?1:0:l[0]<c[0]?-1:1))}var Ge={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qe(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Ge),t),n.progressFn&&r(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.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 n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.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
11
|
${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},Ge);let a=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,u,l;n.progressFn?o=Se(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Se(a);let c=o.length-1;for(let s=c;s>0;s--)n.progressFn&&(l=Math.floor((1-s/c)*78)+21,l!==u&&l>u&&(u=l,n.progressFn(l))),(o[s][0]<=o[s-1][0]||!n.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||n.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+n.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}var un=!0,Oe="Invariant failed";function Ke(e,t){if(!e){if(un)throw new Error(Oe);var r=typeof t=="function"?t():t,n=r?"".concat(Oe,": ").concat(r):Oe;throw new Error(n)}}function Ye(e,t,r){let n=0,a=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(t&&!Array.isArray(t))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof t}, equal to: ${JSON.stringify(t,null,4)}`);if(r&&typeof r!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(!t||!t.filter(d=>d).length)return e;let o;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?o=[Array.from(t)]:o=Array.from(t);let u=o.length,l=0;o.filter(d=>d).forEach((d,p)=>{if(r&&(n=Math.floor(l/u*10),n!==a&&(a=n,r(n))),!Array.isArray(d))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}th element not an array: ${JSON.stringify(d,null,4)}, which is ${typeof d}`);if(!Number.isInteger(d[0])){if(!Number.isInteger(+d[0])||+d[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(d,null,0)}. Its first element is not an integer, string index, but ${typeof d[0]}, equal to: ${JSON.stringify(d[0],null,4)}.`);o[p][0]=+o[p][0]}if(!Number.isInteger(d[1])){if(!Number.isInteger(+d[1])||+d[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(d,null,0)}. Its second element is not an integer, string index, but ${typeof d[1]}, equal to: ${JSON.stringify(d[1],null,4)}.`);o[p][1]=+o[p][1]}l+=1});let c=qe(o,{progressFn:d=>{r&&(n=10+Math.floor(d/10),n!==a&&(a=n,r(n)))}});Ke(c);let s=c.length;if(s>0){let d=e.slice(c[s-1][1]);e=c.reduce((p,T,f,m)=>{r&&(n=20+Math.floor(f/s*80),n!==a&&(a=n,r(n)));let w=f===0?0:m[f-1][1],L=m[f][0];return`${p}${e.slice(w,L)}${m[f][2]||""}`},""),e+=d}return e}function se(e,t=1){let r="\xA0";function n(o){return Array.from(o).reverse().join("")}function a(o,u,l){let c=l?`
|
|
12
12
|
`:"\r",s=l?"\r":`
|
|
13
13
|
`;if(!o)return o;let d=0,p=0,T="";for(let f=0,m=o.length;f<m;f++)(o[f]===c||o[f]===s&&o[f-1]!==c)&&p++,`\r
|
|
14
|
-
`.includes(o[f])||o[f]===r?(d=0,o[f]===r?T+=o[f]:o[f]===c?p<=u&&(T+=o[f],o[f+1]===s&&(T+=o[f+1],f++)):o[f]===s&&(o==null?void 0:o[f-1])!==c&&p<=u&&(T+=o[f])):(d++,!o[f+1]&&!p&&(T+=" "));return T}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let u="",l="";if(!e.trim())u=e;else if(!e[0].trim()){for(let c=0,s=e.length;c<s;c++)if(e[c].trim()){u=e.slice(0,c);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===r)){for(let c=e.length;c--;)if(e[c].trim()){l=e.slice(c+1);break}}return`${a(u,o,!1)}${e.trim()}${n(a(n(l),o,!0))}`}return e}var gn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function
|
|
15
|
-
${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},
|
|
16
|
-
${JSON.stringify(r,null,4)}`);if(M(this.ranges)&&Array.isArray(this.last())&&n===this.last()[1]){if(this.last()[1]=a,this.last()[2],this.last()[2]!==null&&M(r)){let u=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(u=se(u,this.opts.limitLinebreaksCount)),te(u)&&!u.length||(this.last()[2]=u)}}else{this.ranges||(this.ranges=[]);let u=r!==void 0&&!(te(r)&&!r.length)?[n,a,r&&this.opts.limitToBeAddedWhitespace?se(r,this.opts.limitLinebreaksCount):r]:[n,a];this.ranges.push(u)}}else throw P(n)&&n>=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 a}" equal to: ${JSON.stringify(a,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof n}" equal to: ${JSON.stringify(n,null,4)}`)}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=cn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>M(e[2])?[e[0],e[1],se(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])&&P(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 Ze(e){return typeof e!="string"?e:e.length?[e]:[]}function et(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function le(e){return typeof e=="string"}var tt={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},mn=e=>e+1;function hn(e,t,r,n,a=!1,o=mn){let u=typeof r=="function"?r():r;if(+t<0&&a&&u==="EOL")return u;let l=S(S({},tt),n);if(t>=e.length&&!a)return!1;let c=a?1:r.length,s=0,d=!1,p=!1,T=!1,f=l.maxMismatches,m=t,w=!1,L=!1,b=!1;function h(){return s===1&&f<l.maxMismatches-1}for(;e[m];){let $=o(m);if(l.trimBeforeMatching&&e[m].trim()===""){if(!e[$]&&a&&r==="EOL")return!0;m=o(m);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[m])||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(
|
|
14
|
+
`.includes(o[f])||o[f]===r?(d=0,o[f]===r?T+=o[f]:o[f]===c?p<=u&&(T+=o[f],o[f+1]===s&&(T+=o[f+1],f++)):o[f]===s&&(o==null?void 0:o[f-1])!==c&&p<=u&&(T+=o[f])):(d++,!o[f+1]&&!p&&(T+=" "));return T}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let u="",l="";if(!e.trim())u=e;else if(!e[0].trim()){for(let c=0,s=e.length;c<s;c++)if(e[c].trim()){u=e.slice(0,c);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===r)){for(let c=e.length;c--;)if(e[c].trim()){l=e.slice(c+1);break}}return`${a(u,o,!1)}${e.trim()}${n(a(n(l),o,!0))}`}return e}var gn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Qe(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},gn),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,c)=>!Array.isArray(l)||l.length!==2?(n=c,a=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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${a} elements!`);if(!e.every((l,c)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(n=c,!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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let o=e.length**2,u=0;return Array.from(e).sort((l,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===c[0]?l[1]<c[1]?-1:l[1]>c[1]?1:0:l[0]<c[0]?-1:1))}var Xe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function cn(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Xe),t),n.progressFn&&r(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.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 n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.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(t,null,4)} (type ${typeof t})`);else n=S({},Xe);let a=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,u,l;n.progressFn?o=Qe(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Qe(a);let c=o.length-1;for(let s=c;s>0;s--)n.progressFn&&(l=Math.floor((1-s/c)*78)+21,l!==u&&l>u&&(u=l,n.progressFn(l))),(o[s][0]<=o[s-1][0]||!n.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||n.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+n.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}function M(e){return e!=null}function P(e){return Number.isInteger(e)&&e>=0}function te(e){return typeof e=="string"}var fn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},ze=class{constructor(e){Ee(this,"ranges");Ee(this,"opts");let t=S(S({},fn),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(te(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(te(t.mergeType)&&t.mergeType.trim()==="2")t.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 t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);this.opts=t,this.ranges=[]}add(e,t,r){var o;if(e==null&&t==null)return;if(M(e)&&!M(t)){if(Array.isArray(e)){if(e.length){if(e.some(u=>Array.isArray(u))){e.forEach(u=>{Array.isArray(u)&&this.add(...u)});return}e.length&&P(+e[0])&&P(+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(t,null,0)})`)}else if(!M(e)&&M(t))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(t,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let n=+e,a=+t;if(P(r)&&(r=String(r)),P(n)&&P(a)){if(M(r)&&!te(r)&&!P(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof r}, equal to:
|
|
16
|
+
${JSON.stringify(r,null,4)}`);if(M(this.ranges)&&Array.isArray(this.last())&&n===this.last()[1]){if(this.last()[1]=a,this.last()[2],this.last()[2]!==null&&M(r)){let u=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(u=se(u,this.opts.limitLinebreaksCount)),te(u)&&!u.length||(this.last()[2]=u)}}else{this.ranges||(this.ranges=[]);let u=r!==void 0&&!(te(r)&&!r.length)?[n,a,r&&this.opts.limitToBeAddedWhitespace?se(r,this.opts.limitLinebreaksCount):r]:[n,a];this.ranges.push(u)}}else throw P(n)&&n>=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 a}" equal to: ${JSON.stringify(a,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof n}" equal to: ${JSON.stringify(n,null,4)}`)}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=cn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>M(e[2])?[e[0],e[1],se(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])&&P(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 Ze(e){return typeof e!="string"?e:e.length?[e]:[]}function et(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function le(e){return typeof e=="string"}var tt={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},mn=e=>e+1;function hn(e,t,r,n,a=!1,o=mn){let u=typeof r=="function"?r():r;if(+t<0&&a&&u==="EOL")return u;let l=S(S({},tt),n);if(t>=e.length&&!a)return!1;let c=a?1:r.length,s=0,d=!1,p=!1,T=!1,f=l.maxMismatches,m=t,w=!1,L=!1,b=!1;function h(){return s===1&&f<l.maxMismatches-1}for(;e[m];){let $=o(m);if(l.trimBeforeMatching&&e[m].trim()===""){if(!e[$]&&a&&r==="EOL")return!0;m=o(m);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[m])||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(D=>D.toLowerCase()).includes(e[m].toLowerCase())){if(a&&r==="EOL"&&!e[$])return!0;m=o(m);continue}let y=$>m?r[r.length-c]:r[c-1];if(!l.i&&e[m]===y||l.i&&e[m].toLowerCase()===y.toLowerCase()){if(w||(w=!0),T||(T=!0),c===r.length){if(L=!0,f!==l.maxMismatches)return!1}else c===1&&(b=!0);if(c-=1,s++,h())return!1;if(!c)return s!==r.length||f===l.maxMismatches||!d?m:!1}else if(!d&&!s&&(d=!0),l.maxMismatches&&f&&m){f-=1;for(let D=0;D<=f;D++){let I=$>m?r[r.length-c+1+D]:r[c-2-D],R=e[o(m)];if(I&&(!l.i&&e[m]===I||l.i&&e[m].toLowerCase()===I.toLowerCase())&&(!l.firstMustMatch||c!==r.length)){if(s++,h())return!1;c-=2,w=!0;break}else if(R&&I&&(!l.i&&R===I||l.i&&R.toLowerCase()===I.toLowerCase())&&(!l.firstMustMatch||c!==r.length)){if(!s&&!l.hungry)return!1;c-=1,w=!0;break}else if(I===void 0&&f>=0&&w&&(!l.firstMustMatch||L)&&(!l.lastMustMatch||b))return m}w||(p=m)}else return m===0&&c===1&&!l.lastMustMatch&&T?0:!1;if(p!==!1&&p!==m&&(p=!1),c<1)return m;m=o(m)}if(c>0)return a&&u==="EOL"?!0:l&&l.maxMismatches>=c&&T?p||0:!1}function we(e,t,r,n,a){var d,p;if(et(a)&&Object.prototype.hasOwnProperty.call(a,"trimBeforeMatching")&&a&&typeof a.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(a.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o=S(S({},tt),a);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=Ze(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(T=>le(T)?T:String(T)),!le(t)||!t.length)return!1;if(!Number.isInteger(r)||r<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 r}, equal to:
|
|
17
17
|
${JSON.stringify(r,null,4)}`);let u,l;if(le(n))u=[n];else if(Array.isArray(n))u=n;else if(!n)u=n;else if(typeof n=="function")u=[],u.push(n);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 n}, equal to:
|
|
18
18
|
${JSON.stringify(n,null,4)}`);if(a&&!et(a))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 a}", and equal to:
|
|
19
19
|
${JSON.stringify(a,null,4)}`);let c=0,s="";if(o!=null&&o.trimCharsBeforeMatching&&o.trimCharsBeforeMatching.some((T,f)=>T.length>1?(c=f,s=T,!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 ${c} is longer than 1 character, ${s.length} (equals to ${s}). Please split it into separate characters and put into array as separate elements.`);if(!u||!Array.isArray(u)||Array.isArray(u)&&!u.length||Array.isArray(u)&&u.length===1&&le(u[0])&&!u[0].trim()){if(typeof o.cb=="function"){let f,m=r;if((e==="matchLeftIncl"||e==="matchRight")&&(m+=1),e[5]==="L")for(let h=m;h--;){let $=t[h];if((!o.trimBeforeMatching||o.trimBeforeMatching&&$!==void 0&&$.trim())&&(!((d=o.trimCharsBeforeMatching)!=null&&d.length)||$!==void 0&&!o.trimCharsBeforeMatching.includes($))){f=h;break}}else if(e.startsWith("matchRight"))for(let h=m;h<t.length;h++){let $=t[h];if((!o.trimBeforeMatching||o.trimBeforeMatching&&$.trim())&&(!((p=o.trimCharsBeforeMatching)!=null&&p.length)||!o.trimCharsBeforeMatching.includes($))){f=h;break}}if(f===void 0)return!1;let w=t[f],L=f+1,b="";return L&&L>0&&(b=t.slice(0,L)),e[5]==="L"||f&&f>0&&(b=t.slice(f)),o.cb(w,b,f)}let T="";throw a||(T=" 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!${T}`)}for(let T=0,f=u.length;T<f;T++){l=typeof u[T]=="function";let m=u[T],w,L,b="",h=r;e==="matchRight"?h+=1:e==="matchLeft"&&(h-=1);let $=hn(t,h,m,o,l,y=>e[5]==="L"?y-1:y+1);if($&&l&&typeof m=="function"&&m()==="EOL")return m()&&(!o.cb||o.cb(w,b,L))?m():!1;if(Number.isInteger($)&&(L=e.startsWith("matchLeft")?$-1:$+1,e[5]==="L"?b=t.slice(0,$):b=t.slice(L)),L<0&&(L=void 0),t[L]&&(w=t[L]),Number.isInteger($)&&(!o.cb||o.cb(w,b,L)))return m}return!1}function nt(e,t,r,n){return we("matchLeft",e,t,r,n)}function Le(e,t,r,n){return we("matchRightIncl",e,t,r,n)}function k(e,t,r,n){return we("matchRight",e,t,r,n)}var $n={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function ae(e){var c;let t=/^[0-9a-zA-Z]+$/;function r(s){return!s||typeof s!="string"?!1:!s.trim()}function n(s){return typeof s=="string"}if(!e||typeof e!="object"||Array.isArray(e)){let s;throw e===void 0?s="but it is missing completely.":e===null?s="but it was given as null.":s=`but it was given as ${typeof e}, equal to:
|
|
20
20
|
${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] Input must be a plain object ${s}`)}else if(typeof e=="object"&&e!==null&&!Array.isArray(e)&&!Object.keys(e).length)throw new Error("string-range-expander: [THROW_ID_02] Input must be a plain object but it was given as a plain object without any keys.");if(typeof e.from!="number")throw new Error(`string-range-expander: [THROW_ID_03] The input's "from" value resolvedOpts.from, is not a number! Currently it's given as ${typeof e.from}, equal to ${JSON.stringify(e.from,null,0)}`);if(typeof e.to!="number")throw new Error(`string-range-expander: [THROW_ID_04] The input's "to" value resolvedOpts.to, is not a number! Currently it's 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(n(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!n(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide!==!1)throw new Error(`string-range-expander: [THROW_ID_08] The resolvedOpts.extendToOneSide value is not recognisable! It's set to: "${e.extendToOneSide}" (${typeof e.extendToOneSide}). It has to be either Boolean "false" or strings "left" or "right"`);let a=S(S({},$n),e);if(Array.isArray(a.ifLeftSideIncludesThisThenCropTightly)){let s,d;if(a.ifLeftSideIncludesThisThenCropTightly.every((p,T)=>n(p)?!0:(s=T,d=p,!1)))a.ifLeftSideIncludesThisThenCropTightly=a.ifLeftSideIncludesThisThenCropTightly.join("");else throw new Error(`string-range-expander: [THROW_ID_09] The resolvedOpts.ifLeftSideIncludesThisThenCropTightly was set to an array:
|
|
21
|
-
${JSON.stringify(a.ifLeftSideIncludesThisThenCropTightly,null,4)}. Now, that array contains not only string elements. For example, an element at index ${s} is of a type ${typeof d} (equal to ${JSON.stringify(d,null,0)}).`)}let o=a.str,u=a.from,l=a.to;if(a.extendToOneSide!=="right"&&(r(o[u-1])&&(r(o[u-2])||a.ifLeftSideIncludesThisCropItToo.includes(o[u-2]))||o[u-1]&&a.ifLeftSideIncludesThisCropItToo.includes(o[u-1])||a.wipeAllWhitespaceOnLeft&&r(o[u-1]))){for(let s=u;s--;)if(!a.ifLeftSideIncludesThisCropItToo.includes(o[s])){if(o[s].trim()){a.wipeAllWhitespaceOnLeft||a.ifLeftSideIncludesThisCropItToo.includes(o[s+1])?u=s+1:u=s+2;break}else if(s===0){a.wipeAllWhitespaceOnLeft?u=0:u=1;break}}}if(a.extendToOneSide!=="left"&&(r(o[l])&&(a.wipeAllWhitespaceOnRight||r(o[l+1]))||a.ifRightSideIncludesThisCropItToo.includes(o[l]))){for(let s=l,d=o.length;s<d;s++)if(!a.ifRightSideIncludesThisCropItToo.includes(o[s])&&((c=o[s])!=null&&c.trim())){a.wipeAllWhitespaceOnRight||a.ifRightSideIncludesThisCropItToo.includes(o[s-1])?l=s:l=s-1;break}}return(a.extendToOneSide!=="right"&&n(a.ifLeftSideIncludesThisThenCropTightly)&&a.ifLeftSideIncludesThisThenCropTightly&&(o[u-2]&&a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-2])||o[u-1]&&a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))||a.extendToOneSide!=="left"&&n(a.ifRightSideIncludesThisThenCropTightly)&&a.ifRightSideIncludesThisThenCropTightly&&(o[l+1]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l+1])||o[l]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l])))&&(a.extendToOneSide!=="right"&&r(o[u-1])&&!a.wipeAllWhitespaceOnLeft&&(u-=1),a.extendToOneSide!=="left"&&r(o[l])&&!a.wipeAllWhitespaceOnRight&&(l+=1)),a.addSingleSpaceToPreventAccidentalConcatenation&&o[u-1]&&o[u-1].trim()&&o[l]&&o[l].trim()&&(!a.ifLeftSideIncludesThisThenCropTightly&&!a.ifRightSideIncludesThisThenCropTightly||!((!a.ifLeftSideIncludesThisThenCropTightly||a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))&&(!a.ifRightSideIncludesThisThenCropTightly||o[l]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l]))))&&(t.test(o[u-1])||t.test(o[l]))?[u,l," "]:[u,l]}var kr=sn(
|
|
21
|
+
${JSON.stringify(a.ifLeftSideIncludesThisThenCropTightly,null,4)}. Now, that array contains not only string elements. For example, an element at index ${s} is of a type ${typeof d} (equal to ${JSON.stringify(d,null,0)}).`)}let o=a.str,u=a.from,l=a.to;if(a.extendToOneSide!=="right"&&(r(o[u-1])&&(r(o[u-2])||a.ifLeftSideIncludesThisCropItToo.includes(o[u-2]))||o[u-1]&&a.ifLeftSideIncludesThisCropItToo.includes(o[u-1])||a.wipeAllWhitespaceOnLeft&&r(o[u-1]))){for(let s=u;s--;)if(!a.ifLeftSideIncludesThisCropItToo.includes(o[s])){if(o[s].trim()){a.wipeAllWhitespaceOnLeft||a.ifLeftSideIncludesThisCropItToo.includes(o[s+1])?u=s+1:u=s+2;break}else if(s===0){a.wipeAllWhitespaceOnLeft?u=0:u=1;break}}}if(a.extendToOneSide!=="left"&&(r(o[l])&&(a.wipeAllWhitespaceOnRight||r(o[l+1]))||a.ifRightSideIncludesThisCropItToo.includes(o[l]))){for(let s=l,d=o.length;s<d;s++)if(!a.ifRightSideIncludesThisCropItToo.includes(o[s])&&((c=o[s])!=null&&c.trim())){a.wipeAllWhitespaceOnRight||a.ifRightSideIncludesThisCropItToo.includes(o[s-1])?l=s:l=s-1;break}}return(a.extendToOneSide!=="right"&&n(a.ifLeftSideIncludesThisThenCropTightly)&&a.ifLeftSideIncludesThisThenCropTightly&&(o[u-2]&&a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-2])||o[u-1]&&a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))||a.extendToOneSide!=="left"&&n(a.ifRightSideIncludesThisThenCropTightly)&&a.ifRightSideIncludesThisThenCropTightly&&(o[l+1]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l+1])||o[l]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l])))&&(a.extendToOneSide!=="right"&&r(o[u-1])&&!a.wipeAllWhitespaceOnLeft&&(u-=1),a.extendToOneSide!=="left"&&r(o[l])&&!a.wipeAllWhitespaceOnRight&&(l+=1)),a.addSingleSpaceToPreventAccidentalConcatenation&&o[u-1]&&o[u-1].trim()&&o[l]&&o[l].trim()&&(!a.ifLeftSideIncludesThisThenCropTightly&&!a.ifRightSideIncludesThisThenCropTightly||!((!a.ifLeftSideIncludesThisThenCropTightly||a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))&&(!a.ifRightSideIncludesThisThenCropTightly||o[l]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l]))))&&(t.test(o[u-1])||t.test(o[l]))?[u,l," "]:[u,l]}var kr=sn(jt(),1);var K="\xA0";function jr({str:e,idx:t=0,stopAtNewlines:r=!1,stopAtRawNbsp:n=!1}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),!e[t+1]))return null;if(e[t+1]&&(e[t+1].trim()||r&&`
|
|
22
22
|
\r`.includes(e[t+1])||n&&e[t+1]===K))return t+1;if(e[t+2]&&(e[t+2].trim()||r&&`
|
|
23
23
|
\r`.includes(e[t+2])||n&&e[t+2]===K))return t+2;for(let a=t+1,o=e.length;a<o;a++)if(e[a].trim()||r&&`
|
|
24
|
-
\r`.includes(e[a])||n&&e[a]===K)return a;return null}function
|
|
24
|
+
\r`.includes(e[a])||n&&e[a]===K)return a;return null}function A(e,t=0){return jr({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ur({str:e,idx:t,stopAtNewlines:r,stopAtRawNbsp:n}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||r&&`
|
|
25
25
|
\r`.includes(e[~-t])||n&&e[~-t]===K))return~-t;if(e[t-2]&&(e[t-2].trim()||r&&`
|
|
26
26
|
\r`.includes(e[t-2])||n&&e[t-2]===K))return t-2;for(let a=t;a--;)if(e[a]&&(e[a].trim()||r&&`
|
|
27
|
-
\r`.includes(e[a])||n&&e[a]===K))return a;return null}function de(e,t=0){return
|
|
27
|
+
\r`.includes(e[a])||n&&e[a]===K))return a;return null}function de(e,t=0){return Ur({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ut="6.0.6";var qr=Ut,E=new ze({limitToBeAddedWhitespace:!0}),Gt={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 Y(e){return typeof e=="string"}function Q(e){return typeof e=="string"&&e.toUpperCase()!==e.toLowerCase()}function Kr(e,t){let r=Date.now();if(!Y(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:
|
|
28
28
|
${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")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 t}, equal to ${JSON.stringify(t,null,4)}`);if(t&&Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length){for(let i=0,Z=t.breakToTheLeftOf.length;i<Z;i++)if(!Y(t.breakToTheLeftOf[i]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${i} is of a type "${typeof t.breakToTheLeftOf[i]}" and is equal to:
|
|
29
|
-
${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.removeHTMLComments=="boolean"&&(n.removeHTMLComments=n.removeHTMLComments?1:0);let a="";Array.isArray(n.breakToTheLeftOf)&&n.breakToTheLeftOf.length&&(a=[...new Set(n.breakToTheLeftOf.map(i=>i[0]))].join(""));let o={removeHTMLComments:!1,removeCSSComments:!1},u=null,l=null,c=!1,s=0,d=0,p=!1,T=!1,f=null,m=null,w=null,L=null,b,h=null,$=null,y=null,
|
|
29
|
+
${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.removeHTMLComments=="boolean"&&(n.removeHTMLComments=n.removeHTMLComments?1:0);let a="";Array.isArray(n.breakToTheLeftOf)&&n.breakToTheLeftOf.length&&(a=[...new Set(n.breakToTheLeftOf.map(i=>i[0]))].join(""));let o={removeHTMLComments:!1,removeCSSComments:!1},u=null,l=null,c=!1,s=0,d=0,p=!1,T=!1,f=null,m=null,w=null,L=null,b,h=null,$=null,y=null,D=null,I=null,R=null,X=">};",z="<",qt="!",Kt=">",Yt="<",We="{},:;<>~+",be=We,Te=We,J=!0,v=e.length,Qt=Math.floor(v/2),Je=.01,Be;n.reportProgressFunc&&(Be=Math.floor(n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Je-n.reportProgressFuncFrom));let V,oe=0,C=`
|
|
30
30
|
`;if(e.includes(`\r
|
|
31
|
-
`)?
|
|
32
|
-
`:e.includes("\r")&&(
|
|
33
|
-
`||e[g]==="\r"||e[g].trim()){g+1<i&&E.push(g+1,i);break}}L=null,b=!1,i+=8;continue}if(!b&&!p&&e.startsWith("<script",i)&&!
|
|
31
|
+
`)?C=`\r
|
|
32
|
+
`:e.includes("\r")&&(C="\r"),v){for(let i=0;i<v;i++){if(n.reportProgressFunc&&(v>1e3&&v<2e3?i===Qt&&n.reportProgressFunc(Math.floor((n.reportProgressFuncTo-n.reportProgressFuncFrom)/2)):v>=2e3&&(V=n.reportProgressFuncFrom+Math.floor(i/v*(Be||1)),V!==oe&&(oe=V,n.reportProgressFunc(V)))),d++,!b&&p&&e[i]==="}"&&e[i-1]==="}"&&(s+1>=n.lineLengthLimit?(E.push(i,i,C),s=0):(h=i,$=i,y=" ")),b&&typeof b=="number"&&i>=b&&(b=void 0),L!==null&&e.startsWith("<\/script",i)&&!Q(e[i+8])){if((n.removeIndentations||n.removeLineBreaks)&&i>0&&e[~-i]&&!e[~-i].trim()){for(let g=i;g--;)if(e[g]===`
|
|
33
|
+
`||e[g]==="\r"||e[g].trim()){g+1<i&&E.push(g+1,i);break}}L=null,b=!1,i+=8;continue}if(!b&&!p&&e.startsWith("<script",i)&&!Q(e[i+7])){L=i,b=!0;let g="";(n.removeLineBreaks||n.removeIndentations)&&l!==null&&(l>0&&(g=C),E.push(l,i,g)),l=null,u=null}if(I!==null&&D===null&&!/\w/.test(e[i])){D=e.slice(I,i);let g=A(e,~-i);typeof g=="number"&&e[g]===">"&&!e[i].trim()&&A(e,i)?E.push(i,A(e,i)):g&&e[g]==="/"&&e[A(e,g)]===">"&&(!e[i].trim()&&A(e,i)&&E.push(i,A(e,i)),e[g+1]!==">"&&A(e,g+1)&&E.push(g+1,A(e,g+1)))}if(!b&&!p&&!f&&e[~-i]==="<"&&I===null&&(/\w/.test(e[i])?I=i:e[A(e,~-i)]==="/"&&/\w/.test(e[A(e,A(e,~-i))]||"")&&(I=A(e,A(e,~-i)))),!b&&(p||f)&&m!==null&&e[i]==="*"&&e[i+1]==="/"&&([h,$]=ae({str:e,from:m,to:i+2,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Te||""}),m=null,h!=null?E.push(h,$):(s+=1,i+=1),b=i+2),!b&&(p||f)&&m===null&&e[i]==="/"&&e[i+1]==="*"&&(o.removeCSSComments||(o.removeCSSComments=!0),n.removeCSSComments&&(m=i)),T&&e.startsWith("![endif",i+1)&&(T=!1),!b&&!p&&!f&&w!==null){let g;e.startsWith("-->",i)?g=3:e[i]===">"&&e[i-1]==="]"&&(g=1),g&&([h,$]=ae({str:e,from:w,to:i+g}),w=null,h!=null?n.lineLengthLimit&&d-($-h)>=n.lineLengthLimit?(E.push(h,$,C),d=-g):(E.push(h,$),d-=$-h):(s+=g-1,i+=g-1),b=i+g)}if(!b&&!p&&!f&&(e.startsWith("<!--",i)||n.removeHTMLComments===2&&e.startsWith("<![endif",i))&&w===null&&(e.startsWith("[if",i+4)?(T||(T=!0),n.removeHTMLComments===2&&(w=i)):n.removeHTMLComments&&(!T||n.removeHTMLComments===2)&&(w=i),o.removeHTMLComments||(o.removeHTMLComments=!0)),!b&&p&&m===null&&e.startsWith("</style",i)&&!Q(e[i+7])?p=!1:!b&&!p&&m===null&&e.startsWith("<style",i)&&!Q(e[i+6])&&(p=!0,(n.removeLineBreaks||n.removeIndentations)&&n.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',i+6)&&e[i+24]&&E.push(i+23,i+23,C)),!b&&!f&&`"'`.includes(e[i])&&e.endsWith("style=",i)&&(f=i),!b&&!e[i].trim())l===null&&(l=i);else if(!b&&!((p||f)&&m!==null)){if(l!==null){if(n.removeLineBreaks&&(s+=1),J)J=!1,(n.removeIndentations||n.removeLineBreaks)&&E.push(0,i);else if(n.removeIndentations&&!n.removeLineBreaks&&(!c&&u!==null&&i>u?E.push(u+1,i):l+1<i&&(e.endsWith("]>",l)||e.endsWith("-->",l)||e.startsWith("<![",i)||e.startsWith("<!--<![",i)?E.push(l,i):e[l]===" "?E.push(l+1,i):e[~-i]===" "?E.push(l,~-i):E.push(l,i," "))),n.removeLineBreaks||f){if(a.includes(e[i])&&Le(e,i,n.breakToTheLeftOf)){!(`\r
|
|
34
34
|
`.includes(e[~-i])&&l===~-i)&&!(e[~-i]===`
|
|
35
|
-
`&&e[i-2]==="\r"&&l===i-2)&&E.push(l,i,
|
|
35
|
+
`&&e[i-2]==="\r"&&l===i-2)&&E.push(l,i,C),h=null,$=null,y=null,l=null,s=1;continue}let g=" ";e[i]==="<"&&k(e,i,n.mindTheInlineTags,{cb:B=>!B||!/\w/.test(B)})||(e[~-l]&&Kt.includes(e[~-l])&&Yt.includes(e[i])||(p||f)&&m===null&&(be.includes(e[~-l])||Te.includes(e[i]))||e.startsWith("!important",i)&&!T||f&&(e[~-l]==="'"||e[~-l]==='"')||e[~-l]==="}"&&e.startsWith("</style",i)||e[i]===">"&&(`'"`.includes(e[de(e,i)])||e[A(e,i)]==="<")||e[i]==="/"&&e[A(e,i)]===">")&&(g="",e[i]==="/"&&e[i+1]===">"&&A(e,i)&&A(e,i)>i+1&&(E.push(i+1,A(e,i)),s-=A(e,i)-i+1)),p&&e[i]==="}"&&l&&e[l-1]==="}"&&(g=" "),g!=null&&g.length&&(s+=1),n.lineLengthLimit?s>=n.lineLengthLimit||!e[i+1]||e[i]===">"||e[i]==="/"&&e[i+1]===">"?((s>n.lineLengthLimit||s===n.lineLengthLimit&&e[i+1]&&e[i+1].trim()&&!X.includes(e[i])&&!z.includes(e[i+1]))&&(g=C,s=1),(s>n.lineLengthLimit||!(g===" "&&i===l+1))&&(E.push(l,i,g),u=null),h=null,$=null,y=null):(h===null||l<h)&&(h=l,$=i,y=g):i===l+1&&g===" "||E.push(l,i,g)}l=null,c||(c=!0)}else J&&(J=!1),n.removeLineBreaks&&(s+=1);c||(c=!0)}if(!b&&!J&&i!==0&&n.removeLineBreaks&&(n.lineLengthLimit||a)&&!e.startsWith("</a",i)){if(a&&Le(e,i,n.breakToTheLeftOf)&&e.slice(0,i).trim()&&(!e.startsWith("<![endif]",i)||!nt(e,i,"<!--"))){E.push(i,i,C),h=null,$=null,y=null,s=1;continue}else if(n.lineLengthLimit&&s<=n.lineLengthLimit){if(!e[i+1]||z.includes(e[i])&&!qt.includes(e[i])||X.includes(e[i])||!e[i].trim()){if(h!==null&&$!==null&&(h!==$||y!=null&&y.length)){let g=y;e[i].trim()&&e[i+1]&&e[i+1].trim()&&s+(y?y.length:0)>n.lineLengthLimit&&(g=C),(s+(g?g.length:0)>n.lineLengthLimit||!(g===" "&&$===h+1&&e[h]===" "))&&(e[~-h]==="}"&&e[$]==="{"||(E.push(h,$,g),u=null))}e[i].trim()&&(z.includes(e[i])||e[~-i]&&X.includes(e[~-i]))&&Y(R)&&(!D||!n.mindTheInlineTags.includes(D))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{cb:g=>!g||!/\w/.test(g)}))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)}))?(h=i,$=i,y=null):m===null&&h!==null&&(f||!n.mindTheInlineTags||!Array.isArray(n.mindTheInlineTags)||Array.isArray(n.mindTheInlineTags.length)&&!n.mindTheInlineTags.length||!Y(D)||Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&Y(D)&&!n.mindTheInlineTags.includes(D))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)}))&&(h=null,$=null,y=null)}}else if(n.lineLengthLimit)if(z.includes(e[i])&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)})))if(h!==null&&$!==null&&(h!==$||y!=null&&y.length)){let g=y!=null&&y.length?y.length:0;s-($-h-g)-1>n.lineLengthLimit||(E.push(h,$,y),s-($-h-g)-1===n.lineLengthLimit&&(E.push(i,i,C),s=0),h=null,$=null,y=null)}else E.push(i,i,C),s=0;else e[i+1]&&X.includes(e[i])&&Y(D)&&Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&!n.mindTheInlineTags.includes(D)?h!==null&&$!==null&&(h!==$||y!=null&&y.length)||(E.push(i+1,i+1,C),s=0):e[i].trim()&&(e[i+1]||h!==null&&$!==null&&(h!==$||y!=null&&y.length)&&E.push(h,$,C))}if(!b&&!J&&n.removeLineBreaks&&n.lineLengthLimit&&s>=n.lineLengthLimit&&h!==null&&$!==null&&!X.includes(e[i])&&!z.includes(e[i])&&!"/".includes(e[i])&&!(s===n.lineLengthLimit&&e[i+1]&&!e[i+1].trim())){let g=C;e[i+1]&&!e[i+1].trim()&&s===n.lineLengthLimit&&(g=y),g===C&&!e[~-h].trim()&&de(e,h)&&(h=de(e,h)+1),E.push(h,$,g),s=i-$,e[i].length&&(s+=1),h=null,$=null,y=null}if((!b&&e[i]===`
|
|
36
36
|
`||e[i]==="\r"&&(!e[i+1]||e[i+1]&&e[i+1]!==`
|
|
37
37
|
`))&&(u=i,c&&(c=!1),!n.removeLineBreaks&&l!==null&&l<i&&e[i+1]&&e[i+1]!=="\r"&&e[i+1]!==`
|
|
38
38
|
`&&E.push(l,i)),e[i+1]||(p&&m!==null?E.push(...ae({str:e,from:m,to:i,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Te||""})):l&&e[i]!==`
|
|
39
39
|
`&&e[i]!=="\r"?E.push(l,i+1):l&&(e[i]==="\r"&&e[i+1]===`
|
|
40
40
|
`||e[i]===`
|
|
41
|
-
`&&e[i-1]!=="\r")&&E.push(l,i)),!b&&f&&f<i&&e[f]===e[i]&&(f=null),!b&&!p&&e.startsWith("<pre",i)&&!
|
|
41
|
+
`&&e[i-1]!=="\r")&&E.push(l,i)),!b&&f&&f<i&&e[f]===e[i]&&(f=null),!b&&!p&&e.startsWith("<pre",i)&&!Q(e[i+4])){let g=e.indexOf("</pre",i+5);g>0&&(b=g)}if(!b&&!p&&e.startsWith("<code",i)&&!Q(e[i+5])){let g=e.indexOf("</code",i+5);g>0&&(b=g)}if(!b&&e.startsWith("<![CDATA[",i)){let g=e.indexOf("]]>",i+9);g>0&&(b=g)}!b&&!p&&!f&&I!==null&&e[i]===">"&&(e[A(e,i)]==="<"&&(R=D),I=null,D=null),e[i]==="<"&&R!==null&&(R=null),p&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(b=e.indexOf("}}")+2);let Z=!0}if(E.current()){let i=E.current();E.wipe();let Z=n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Je,g=Ye(e,i,Xt=>{n.reportProgressFunc&&v>=2e3&&(V=Math.floor(Z+(n.reportProgressFuncTo-Z)*(Xt/100)),V!==oe&&(oe=V,n.reportProgressFunc(V)))}),B=g.length;return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:v,cleanedLength:B,bytesSaved:Math.max(v-B,0),percentageReducedOfOriginal:v?Math.round(Math.max(v-B,0)*100/v):0},ranges:i,applicableOpts:o,result:g}}}return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:v,cleanedLength:v,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:o,ranges:null,result:e}}return ln(Yr);})();
|
|
42
42
|
/**
|
|
43
43
|
* @name ranges-sort
|
|
44
44
|
* @fileoverview Sort string index ranges
|
|
@@ -90,7 +90,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
|
|
|
90
90
|
/**
|
|
91
91
|
* @name string-match-left-right
|
|
92
92
|
* @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
|
|
93
|
-
* @version 9.0.
|
|
93
|
+
* @version 9.0.6
|
|
94
94
|
* @author Roy Revelt, Codsen Ltd
|
|
95
95
|
* @license MIT
|
|
96
96
|
* {@link https://codsen.com/os/string-match-left-right/}
|
|
@@ -106,7 +106,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
|
|
|
106
106
|
/**
|
|
107
107
|
* @name codsen-utils
|
|
108
108
|
* @fileoverview Various utility functions
|
|
109
|
-
* @version 1.
|
|
109
|
+
* @version 1.2.0
|
|
110
110
|
* @author Roy Revelt, Codsen Ltd
|
|
111
111
|
* @license MIT
|
|
112
112
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -114,7 +114,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
|
|
|
114
114
|
/**
|
|
115
115
|
* @name string-left-right
|
|
116
116
|
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
|
|
117
|
-
* @version 6.0.
|
|
117
|
+
* @version 6.0.6
|
|
118
118
|
* @author Roy Revelt, Codsen Ltd
|
|
119
119
|
* @license MIT
|
|
120
120
|
* {@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.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"description": "Minify email templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"breaks",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"ranges-apply": "^7.0.3",
|
|
84
84
|
"ranges-push": "^7.0.3",
|
|
85
|
-
"string-left-right": "^6.0.
|
|
86
|
-
"string-match-left-right": "^9.0.
|
|
85
|
+
"string-left-right": "^6.0.6",
|
|
86
|
+
"string-match-left-right": "^9.0.6",
|
|
87
87
|
"string-range-expander": "^4.0.3",
|
|
88
|
-
"test-mixer": "^4.1.
|
|
88
|
+
"test-mixer": "^4.1.3"
|
|
89
89
|
}
|
|
90
90
|
}
|