@visulima/html 0.0.1 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/LICENSE.md +582 -0
- package/README.md +943 -28
- package/dist/index.d.ts +422 -0
- package/dist/index.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-CV2jkJYL.js +1 -0
- package/dist/packem_shared/css-Dln-sxQh.js +1 -0
- package/dist/packem_shared/encode-CXgEtaTS.js +1 -0
- package/dist/packem_shared/escapeCss-oDJXzCKj.js +1 -0
- package/dist/packem_shared/escapeHtml-BGTH-nez.js +1 -0
- package/dist/packem_shared/escapeJs-BS03wnwB.js +1 -0
- package/dist/packem_shared/html-BiXubKfv.js +1 -0
- package/dist/packem_shared/htmlTags-sIGmCDBO.js +1 -0
- package/dist/packem_shared/isValidCustomElementName-gLEw9R2V.js +1 -0
- package/dist/packem_shared/stripHtmlDefaultOptions-C-cDIZNg.js +54 -0
- package/dist/packem_shared/voidHtmlTags-Bn-JBb1g.js +1 -0
- package/package.json +77 -7
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var Sr=Object.defineProperty;var s=(e,t)=>Sr(e,"name",{value:t,configurable:!0});import{g as Cr}from"./_commonjsHelpers-CV2jkJYL.js";import{decode as Ue}from"./encode-CXgEtaTS.js";var Te,Ge;function Er(){if(Ge)return Te;Ge=1;var e=Object.defineProperty,t=s((o,c)=>e(o,"name",{value:c,configurable:!0}),"p");Te=i;function a(o){return o instanceof Buffer?Buffer.from(o):new o.constructor(o.buffer.slice(),o.byteOffset,o.length)}s(a,"copyBuffer"),t(a,"copyBuffer");function i(o){if(o=o||{},o.circles)return f(o);const c=new Map;if(c.set(Date,m=>new Date(m)),c.set(Map,(m,$)=>new Map(h(Array.from(m),$))),c.set(Set,(m,$)=>new Set(h(Array.from(m),$))),o.constructorHandlers)for(const m of o.constructorHandlers)c.set(m[0],m[1]);let r=null;return o.proto?y:l;function h(m,$){const u=Object.keys(m),d=new Array(u.length);for(let T=0;T<u.length;T++){const O=u[T],P=m[O];typeof P!="object"||P===null?d[O]=P:P.constructor!==Object&&(r=c.get(P.constructor))?d[O]=r(P,$):ArrayBuffer.isView(P)?d[O]=a(P):d[O]=$(P)}return d}function l(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return h(m,l);if(m.constructor!==Object&&(r=c.get(m.constructor)))return r(m,l);const $={};for(const u in m){if(Object.hasOwnProperty.call(m,u)===!1)continue;const d=m[u];typeof d!="object"||d===null?$[u]=d:d.constructor!==Object&&(r=c.get(d.constructor))?$[u]=r(d,l):ArrayBuffer.isView(d)?$[u]=a(d):$[u]=l(d)}return $}function y(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return h(m,y);if(m.constructor!==Object&&(r=c.get(m.constructor)))return r(m,y);const $={};for(const u in m){const d=m[u];typeof d!="object"||d===null?$[u]=d:d.constructor!==Object&&(r=c.get(d.constructor))?$[u]=r(d,y):ArrayBuffer.isView(d)?$[u]=a(d):$[u]=y(d)}return $}}s(i,"rfdc"),t(i,"rfdc");function f(o){const c=[],r=[],h=new Map;if(h.set(Date,u=>new Date(u)),h.set(Map,(u,d)=>new Map(y(Array.from(u),d))),h.set(Set,(u,d)=>new Set(y(Array.from(u),d))),o.constructorHandlers)for(const u of o.constructorHandlers)h.set(u[0],u[1]);let l=null;return o.proto?$:m;function y(u,d){const T=Object.keys(u),O=new Array(T.length);for(let P=0;P<T.length;P++){const W=T[P],C=u[W];if(typeof C!="object"||C===null)O[W]=C;else if(C.constructor!==Object&&(l=h.get(C.constructor)))O[W]=l(C,d);else if(ArrayBuffer.isView(C))O[W]=a(C);else{const B=c.indexOf(C);B!==-1?O[W]=r[B]:O[W]=d(C)}}return O}function m(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return y(u,m);if(u.constructor!==Object&&(l=h.get(u.constructor)))return l(u,m);const d={};c.push(u),r.push(d);for(const T in u){if(Object.hasOwnProperty.call(u,T)===!1)continue;const O=u[T];if(typeof O!="object"||O===null)d[T]=O;else if(O.constructor!==Object&&(l=h.get(O.constructor)))d[T]=l(O,m);else if(ArrayBuffer.isView(O))d[T]=a(O);else{const P=c.indexOf(O);P!==-1?d[T]=r[P]:d[T]=m(O)}}return c.pop(),r.pop(),d}function $(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return y(u,$);if(u.constructor!==Object&&(l=h.get(u.constructor)))return l(u,$);const d={};c.push(u),r.push(d);for(const T in u){const O=u[T];if(typeof O!="object"||O===null)d[T]=O;else if(O.constructor!==Object&&(l=h.get(O.constructor)))d[T]=l(O,$);else if(ArrayBuffer.isView(O))d[T]=a(O);else{const P=c.indexOf(O);P!==-1?d[T]=r[P]:d[T]=$(O)}}return c.pop(),r.pop(),d}}return s(f,"rfdcCircles"),t(f,"rfdcCircles"),Te}s(Er,"requireRfdc");var Nr=Er();const st=Cr(Nr);var Rr=Object.defineProperty,_=s((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"n$i"),Wr=st(),Ir="‘",Fr="’",Br="“",Hr="”";function qr(e){return k(e)&&e.charCodeAt(0)>=48&&e.charCodeAt(0)<=57}s(qr,"N$2");_(qr,"U");function it(e){return k(e)&&"؋$₼៛¥₡₱£€¢₹﷼₪₩₭₨₮₦₽₫฿₩₺₴".includes(e)}s(it,"p$b");_(it,"g");function Lr(e){let t=new Set(["$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","Kč","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","zł","ƒ","Дин.","ден","лв","د.إ","Lek"]);return k(e)&&!!e.trim()&&(it(e)||t.has(e))}s(Lr,"R$3");_(Lr,"F");function We(e){return k(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}s(We,"a$s");_(We,"s");function xr(e){return!!(e&&k(e)&&(e.charCodeAt(0)>64&&e.charCodeAt(0)<91||e.charCodeAt(0)>96&&e.charCodeAt(0)<123))}s(xr,"T$3");_(xr,"I");function Dr(e){return k(e)&&(e==='"'||e==="'"||e===Ir||e===Fr||e===Br||e===Hr)}s(Dr,"j$1");_(Dr,"P");function Jr(e){return!k(e)||!We(e)?!1:e===e.toLowerCase()&&e!==e.toUpperCase()}s(Jr,"P$1");_(Jr,"M");function Mr(e){return!k(e)||!We(e)?!1:e===e.toUpperCase()&&e!==e.toLowerCase()}s(Mr,"I$3");_(Mr,"Q");function zr(e){return!k(e)||!e?!1:!e[0].trim()}s(zr,"Q");_(zr,"V");_(e=>k(e)&&e.length&&e.endsWith("/")?e.slice(0,-1).trim():e,"B");function F(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}s(F,"s$c");_(F,"u");function Vr(e="",t=0,a=0,i=""){return t<0&&(t+=e.length,t<0&&(t=0)),e.slice(0,t)+(i||"")+e.slice(t+a)}s(Vr,"U$1");_(Vr,"K");function k(e){return typeof e=="string"}s(k,"t$q");_(k,"r");function ot(e){return Number.isFinite(e)}s(ot,"J$1");_(ot,"W");function D(e){return Number.isSafeInteger(e)&&e>=0}s(D,"W");_(D,"q");function Ur(e){return typeof e=="boolean"}s(Ur,"q");_(Ur,"H");function Gr(e){return e===null}s(Gr,"H$1");_(Gr,"Z");function lt(e){return e instanceof RegExp}s(lt,"m$9");_(lt,"x");function Kr(e,t){if(!k(e)||!k(t))return[];let a=[],i=-1;for(;(i=e.indexOf(t,i+1))>=0;)a.push(i);return a}s(Kr,"K");_(Kr,"_");function Zr(e=[],t=[]){return!e||!Array.isArray(e)||!e.length?[]:!t||!Array.isArray(t)||!t.length?e:e.filter(a=>!t.includes(a))}s(Zr,"Z$1");_(Zr,"z");function x(e){return e!=null}s(x,"_$3");_(x,"G");function Qr(e){return[...new Set(e)]}s(Qr,"z$1");_(Qr,"X");function ut(e){if(!(typeof e!="string"||!e)){if(e.includes(`\r
|
|
2
|
+
`))return`\r
|
|
3
|
+
`;if(e.includes(`
|
|
4
|
+
`))return`
|
|
5
|
+
`;if(e.includes("\r"))return"\r"}}s(ut,"b$5");_(ut,"b");function Xr(e,t,a=`
|
|
6
|
+
`){if(![`\r
|
|
7
|
+
`,"\r",`
|
|
8
|
+
`].includes(a))throw new Error(`codsen-utils/resolveEolSetting(): the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as ${JSON.stringify(a,null,0)}`);return t==="crlf"?`\r
|
|
9
|
+
`:t==="cr"?"\r":t==="lf"?`
|
|
10
|
+
`:ut(e)||a}s(Xr,"G");_(Xr,"Y");function ft(e,t){return F(e)&&k(t)&&t in e}s(ft,"V");_(ft,"v");function Yr(e,t){return e.localeCompare(t)}s(Yr,"X");_(Yr,"tt");function en(e,t){return!Array.isArray(e)||!e.length?!1:e.some(a=>lt(a)&&t.match(a)||typeof a=="string"&&t===a)}s(en,"er");_(en,"rt");function tn(e=[],t=[]){return!e||!t?[]:Array.from(new Set(Array.from(e).filter(a=>new Set(t).has(a))))}s(tn,"nr");_(tn,"ot");function rn(e,t=[]){if(!e)return e;if(!F(e))throw new Error(`codsen-utils/omit(): [THROW_ID_01] Input must be a plain object! It was given as ${JSON.stringify(e,null,4)} (typeof is "${typeof e}")`);let a=Wr(e);return t.forEach(i=>{delete a[i]}),a}s(rn,"ur");_(rn,"it");var nn=typeof global=="object"&&global&&global.Object===Object&&global,an=typeof self=="object"&&self&&self.Object===Object&&self,Ie=nn||an||Function("return this")(),Y=Ie.Symbol,sn=Object.defineProperty,on=s((e,t)=>sn(e,"name",{value:t,configurable:!0}),"o$p"),ct=Object.prototype,ln=ct.hasOwnProperty,un=ct.toString,te=Y?Y.toStringTag:void 0;function gt(e){var t=ln.call(e,te),a=e[te];try{e[te]=void 0;var i=!0}catch{}var f=un.call(e);return i&&(t?e[te]=a:delete e[te]),f}s(gt,"s$b");on(gt,"getRawTag");var fn=Object.defineProperty,cn=s((e,t)=>fn(e,"name",{value:t,configurable:!0}),"o$o"),gn=Object.prototype,pn=gn.toString;function pt(e){return pn.call(e)}s(pt,"a$q");cn(pt,"objectToString");var hn=Object.defineProperty,dn=s((e,t)=>hn(e,"name",{value:t,configurable:!0}),"t$o"),mn="[object Null]",yn="[object Undefined]",Ke=Y?Y.toStringTag:void 0;function Fe(e){return e==null?e===void 0?yn:mn:Ke&&Ke in Object(e)?gt(e):pt(e)}s(Fe,"T$2");dn(Fe,"baseGetTag");var bn=Object.defineProperty,vn=s((e,t)=>bn(e,"name",{value:t,configurable:!0}),"e$k");function Be(e){return e!=null&&typeof e=="object"}s(Be,"c$c");vn(Be,"isObjectLike");var $n=Object.defineProperty,On=s((e,t)=>$n(e,"name",{value:t,configurable:!0}),"t$n"),Tn="[object Symbol]";function ht(e){return typeof e=="symbol"||Be(e)&&Fe(e)==Tn}s(ht,"f$m");On(ht,"isSymbol");var An=Object.defineProperty,wn=s((e,t)=>An(e,"name",{value:t,configurable:!0}),"h$a");function He(e,t){for(var a=-1,i=e==null?0:e.length,f=Array(i);++a<i;)f[a]=t(e[a],a,e);return f}s(He,"r$k");wn(He,"arrayMap");var jn=Array.isArray,_n=Object.defineProperty,Pn=s((e,t)=>_n(e,"name",{value:t,configurable:!0}),"t$m"),Ze=Y?Y.prototype:void 0,Qe=Ze?Ze.toString:void 0;function ye(e){if(typeof e=="string")return e;if(jn(e))return He(e,ye)+"";if(ht(e))return Qe?Qe.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}s(ye,"m$7");Pn(ye,"baseToString");var kn=Object.defineProperty,Sn=s((e,t)=>kn(e,"name",{value:t,configurable:!0}),"r$i"),Cn=/\s/;function dt(e){for(var t=e.length;t--&&Cn.test(e.charAt(t)););return t}s(dt,"d$c");Sn(dt,"trimmedEndIndex");var En=Object.defineProperty,Nn=s((e,t)=>En(e,"name",{value:t,configurable:!0}),"r$h"),Rn=/^\s+/;function mt(e){return e&&e.slice(0,dt(e)+1).replace(Rn,"")}s(mt,"o$m");Nn(mt,"baseTrim");var Wn=Object.defineProperty,In=s((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"n$e");function qe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}s(qe,"c$b");In(qe,"isObject");var Fn=Object.defineProperty,Bn=s((e,t)=>Fn(e,"name",{value:t,configurable:!0}),"e$j");function Le(e){return e}s(Le,"r$g");Bn(Le,"identity");var Hn=Object.defineProperty,qn=s((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"o$k"),Ln="[object AsyncFunction]",xn="[object Function]",Dn="[object GeneratorFunction]",Jn="[object Proxy]";function xe(e){if(!qe(e))return!1;var t=Fe(e);return t==xn||t==Dn||t==Ln||t==Jn}s(xe,"g$6");qn(xe,"isFunction");var Ae=Ie["__core-js_shared__"],Mn=Object.defineProperty,zn=s((e,t)=>Mn(e,"name",{value:t,configurable:!0}),"t$l"),Xe=(function(){var e=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function yt(e){return!!Xe&&Xe in e}s(yt,"s$a");zn(yt,"isMasked");var Vn=Object.defineProperty,Un=s((e,t)=>Vn(e,"name",{value:t,configurable:!0}),"o$h"),Gn=Function.prototype,Kn=Gn.toString;function bt(e){if(e!=null){try{return Kn.call(e)}catch{}try{return e+""}catch{}}return""}s(bt,"u$b");Un(bt,"toSource");var Zn=Object.defineProperty,Qn=s((e,t)=>Zn(e,"name",{value:t,configurable:!0}),"o$g"),Xn=/[\\^$.*+?()[\]{}|]/g,Yn=/^\[object .+?Constructor\]$/,ea=Function.prototype,ta=Object.prototype,ra=ea.toString,na=ta.hasOwnProperty,aa=RegExp("^"+ra.call(na).replace(Xn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vt(e){if(!qe(e)||yt(e))return!1;var t=xe(e)?aa:Yn;return t.test(bt(e))}s(vt,"b$4");Qn(vt,"baseIsNative");var sa=Object.defineProperty,ia=s((e,t)=>sa(e,"name",{value:t,configurable:!0}),"u$9");function $t(e,t){return e?.[t]}s($t,"t$k");ia($t,"getValue");var oa=Object.defineProperty,la=s((e,t)=>oa(e,"name",{value:t,configurable:!0}),"a$l");function be(e,t){var a=$t(e,t);return vt(a)?a:void 0}s(be,"f$i");la(be,"getNative");var ua=Object.defineProperty,fa=s((e,t)=>ua(e,"name",{value:t,configurable:!0}),"t$j");function Ot(e,t,a){switch(a.length){case 0:return e.call(t);case 1:return e.call(t,a[0]);case 2:return e.call(t,a[0],a[1]);case 3:return e.call(t,a[0],a[1],a[2])}return e.apply(t,a)}s(Ot,"a$k");fa(Ot,"apply");var ca=Object.defineProperty,ga=s((e,t)=>ca(e,"name",{value:t,configurable:!0}),"a$j"),pa=800,ha=16,da=Date.now;function Tt(e){var t=0,a=0;return function(){var i=da(),f=ha-(i-a);if(a=i,f>0){if(++t>=pa)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}s(Tt,"s$8");ga(Tt,"shortOut");var ma=Object.defineProperty,ya=s((e,t)=>ma(e,"name",{value:t,configurable:!0}),"t$i");function At(e){return function(){return e}}s(At,"e$g");ya(At,"constant");var Ye=(function(){try{var e=be(Object,"defineProperty");return e({},"",{}),e}catch{}})(),ba=Ye?function(e,t){return Ye(e,"toString",{configurable:!0,enumerable:!1,value:At(t),writable:!0})}:Le,va=Tt(ba),$a=Object.defineProperty,Oa=s((e,t)=>$a(e,"name",{value:t,configurable:!0}),"i$8");function wt(e,t,a,i){for(var f=e.length,o=a+(i?1:-1);i?o--:++o<f;)if(t(e[o],o,e))return o;return-1}s(wt,"f$g");Oa(wt,"baseFindIndex");var Ta=Object.defineProperty,Aa=s((e,t)=>Ta(e,"name",{value:t,configurable:!0}),"e$f");function jt(e){return e!==e}s(jt,"a$i");Aa(jt,"baseIsNaN");var wa=Object.defineProperty,ja=s((e,t)=>wa(e,"name",{value:t,configurable:!0}),"i$7");function _t(e,t,a){for(var i=a-1,f=e.length;++i<f;)if(e[i]===t)return i;return-1}s(_t,"u$7");ja(_t,"strictIndexOf");var _a=Object.defineProperty,Pa=s((e,t)=>_a(e,"name",{value:t,configurable:!0}),"e$e");function ve(e,t,a){return t===t?_t(e,t,a):wt(e,jt,a)}s(ve,"s$7");Pa(ve,"baseIndexOf");var ka=Object.defineProperty,Sa=s((e,t)=>ka(e,"name",{value:t,configurable:!0}),"t$g");function Pt(e,t){var a=e==null?0:e.length;return!!a&&ve(e,t,0)>-1}s(Pt,"o$d");Sa(Pt,"arrayIncludes");var Ca=Object.defineProperty,Ea=s((e,t)=>Ca(e,"name",{value:t,configurable:!0}),"t$f");function kt(e,t){return e===t||e!==e&&t!==t}s(kt,"d$a");Ea(kt,"eq");var Na=Object.defineProperty,Ra=s((e,t)=>Na(e,"name",{value:t,configurable:!0}),"o$c"),et=Math.max;function St(e,t,a){return t=et(t===void 0?e.length-1:t,0),function(){for(var i=arguments,f=-1,o=et(i.length-t,0),c=Array(o);++f<o;)c[f]=i[t+f];f=-1;for(var r=Array(t+1);++f<t;)r[f]=i[f];return r[t]=a(c),Ot(e,this,r)}}s(St,"f$e");Ra(St,"overRest");var Wa=Object.defineProperty,Ia=s((e,t)=>Wa(e,"name",{value:t,configurable:!0}),"o$b");function Ct(e,t){return va(St(e,t,Le),e+"")}s(Ct,"n$b");Ia(Ct,"baseRest");var Fa=Object.defineProperty,Ba=s((e,t)=>Fa(e,"name",{value:t,configurable:!0}),"n$a"),Ha=9007199254740991;function Et(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ha}s(Et,"o$a");Ba(Et,"isLength");var qa=Object.defineProperty,La=s((e,t)=>qa(e,"name",{value:t,configurable:!0}),"t$e");function Nt(e){return e!=null&&Et(e.length)&&!xe(e)}s(Nt,"f$c");La(Nt,"isArrayLike");var xa=Object.defineProperty,Da=s((e,t)=>xa(e,"name",{value:t,configurable:!0}),"t$d");function Rt(e){return function(t){return e(t)}}s(Rt,"u$5");Da(Rt,"baseUnary");var ae=be(Object,"create"),Ja=Object.defineProperty,Ma=s((e,t)=>Ja(e,"name",{value:t,configurable:!0}),"t$b");function Wt(){this.__data__=ae?ae(null):{},this.size=0}s(Wt,"h$9");Ma(Wt,"hashClear");var za=Object.defineProperty,Va=s((e,t)=>za(e,"name",{value:t,configurable:!0}),"s$6");function It(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}s(It,"h$8");Va(It,"hashDelete");var Ua=Object.defineProperty,Ga=s((e,t)=>Ua(e,"name",{value:t,configurable:!0}),"e$a"),Ka="__lodash_hash_undefined__",Za=Object.prototype,Qa=Za.hasOwnProperty;function Ft(e){var t=this.__data__;if(ae){var a=t[e];return a===Ka?void 0:a}return Qa.call(t,e)?t[e]:void 0}s(Ft,"i$6");Ga(Ft,"hashGet");var Xa=Object.defineProperty,Ya=s((e,t)=>Xa(e,"name",{value:t,configurable:!0}),"r$c"),es=Object.prototype,ts=es.hasOwnProperty;function Bt(e){var t=this.__data__;return ae?t[e]!==void 0:ts.call(t,e)}s(Bt,"d$8");Ya(Bt,"hashHas");var rs=Object.defineProperty,ns=s((e,t)=>rs(e,"name",{value:t,configurable:!0}),"_$1"),as="__lodash_hash_undefined__";function Ht(e,t){var a=this.__data__;return this.size+=this.has(e)?0:1,a[e]=ae&&t===void 0?as:t,this}s(Ht,"d$7");ns(Ht,"hashSet");var ss=Object.defineProperty,is=s((e,t)=>ss(e,"name",{value:t,configurable:!0}),"h$5");function z(e){var t=-1,a=e==null?0:e.length;for(this.clear();++t<a;){var i=e[t];this.set(i[0],i[1])}}s(z,"t$a");is(z,"Hash");z.prototype.clear=Wt;z.prototype.delete=It;z.prototype.get=Ft;z.prototype.has=Bt;z.prototype.set=Ht;var os=Object.defineProperty,ls=s((e,t)=>os(e,"name",{value:t,configurable:!0}),"t$9");function qt(){this.__data__=[],this.size=0}s(qt,"s$4");ls(qt,"listCacheClear");var us=Object.defineProperty,fs=s((e,t)=>us(e,"name",{value:t,configurable:!0}),"r$b");function oe(e,t){for(var a=e.length;a--;)if(kt(e[a][0],t))return a;return-1}s(oe,"i$4");fs(oe,"assocIndexOf");var cs=Object.defineProperty,gs=s((e,t)=>cs(e,"name",{value:t,configurable:!0}),"a$f"),ps=Array.prototype,hs=ps.splice;function Lt(e){var t=this.__data__,a=oe(t,e);if(a<0)return!1;var i=t.length-1;return a==i?t.pop():hs.call(t,a,1),--this.size,!0}s(Lt,"p$6");gs(Lt,"listCacheDelete");var ds=Object.defineProperty,ms=s((e,t)=>ds(e,"name",{value:t,configurable:!0}),"d$6");function xt(e){var t=this.__data__,a=oe(t,e);return a<0?void 0:t[a][1]}s(xt,"r$a");ms(xt,"listCacheGet");var ys=Object.defineProperty,bs=s((e,t)=>ys(e,"name",{value:t,configurable:!0}),"a$e");function Dt(e){return oe(this.__data__,e)>-1}s(Dt,"s$3");bs(Dt,"listCacheHas");var vs=Object.defineProperty,$s=s((e,t)=>vs(e,"name",{value:t,configurable:!0}),"a$d");function Jt(e,t){var a=this.__data__,i=oe(a,e);return i<0?(++this.size,a.push([e,t])):a[i][1]=t,this}s(Jt,"f$a");$s(Jt,"listCacheSet");var Os=Object.defineProperty,Ts=s((e,t)=>Os(e,"name",{value:t,configurable:!0}),"l$5");function K(e){var t=-1,a=e==null?0:e.length;for(this.clear();++t<a;){var i=e[t];this.set(i[0],i[1])}}s(K,"t$8");Ts(K,"ListCache");K.prototype.clear=qt;K.prototype.delete=Lt;K.prototype.get=xt;K.prototype.has=Dt;K.prototype.set=Jt;var As=be(Ie,"Map"),ws=Object.defineProperty,js=s((e,t)=>ws(e,"name",{value:t,configurable:!0}),"a$b");function Mt(){this.size=0,this.__data__={hash:new z,map:new(As||K),string:new z}}s(Mt,"h$4");js(Mt,"mapCacheClear");var _s=Object.defineProperty,Ps=s((e,t)=>_s(e,"name",{value:t,configurable:!0}),"e$8");function zt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}s(zt,"r$7");Ps(zt,"isKeyable");var ks=Object.defineProperty,Ss=s((e,t)=>ks(e,"name",{value:t,configurable:!0}),"e$7");function le(e,t){var a=e.__data__;return zt(t)?a[typeof t=="string"?"string":"hash"]:a.map}s(le,"o$7");Ss(le,"getMapData");var Cs=Object.defineProperty,Es=s((e,t)=>Cs(e,"name",{value:t,configurable:!0}),"a$a");function Vt(e){var t=le(this,e).delete(e);return this.size-=t?1:0,t}s(Vt,"l$4");Es(Vt,"mapCacheDelete");var Ns=Object.defineProperty,Rs=s((e,t)=>Ns(e,"name",{value:t,configurable:!0}),"a$9");function Ut(e){return le(this,e).get(e)}s(Ut,"p$5");Rs(Ut,"mapCacheGet");var Ws=Object.defineProperty,Is=s((e,t)=>Ws(e,"name",{value:t,configurable:!0}),"t$6");function Gt(e){return le(this,e).has(e)}s(Gt,"p$4");Is(Gt,"mapCacheHas");var Fs=Object.defineProperty,Bs=s((e,t)=>Fs(e,"name",{value:t,configurable:!0}),"i$2");function Kt(e,t){var a=le(this,e),i=a.size;return a.set(e,t),this.size+=a.size==i?0:1,this}s(Kt,"o$6");Bs(Kt,"mapCacheSet");var Hs=Object.defineProperty,qs=s((e,t)=>Hs(e,"name",{value:t,configurable:!0}),"a$8");function Z(e){var t=-1,a=e==null?0:e.length;for(this.clear();++t<a;){var i=e[t];this.set(i[0],i[1])}}s(Z,"e$5");qs(Z,"MapCache");Z.prototype.clear=Mt;Z.prototype.delete=Vt;Z.prototype.get=Ut;Z.prototype.has=Gt;Z.prototype.set=Kt;var Ls=Object.defineProperty,xs=s((e,t)=>Ls(e,"name",{value:t,configurable:!0}),"r$3");function Zt(e){return e==null?"":ye(e)}s(Zt,"e$4");xs(Zt,"toString");var Ds=Object.defineProperty,Js=s((e,t)=>Ds(e,"name",{value:t,configurable:!0}),"c$7");function Qt(e,t,a){var i=-1,f=e.length;t<0&&(t=-t>f?0:f+t),a=a>f?f:a,a<0&&(a+=f),f=t>a?0:a-t>>>0,t>>>=0;for(var o=Array(f);++i<f;)o[i]=e[i+t];return o}s(Qt,"o$4");Js(Qt,"baseSlice");var Ms=Object.defineProperty,zs=s((e,t)=>Ms(e,"name",{value:t,configurable:!0}),"c$6");function Xt(e,t,a){var i=e.length;return a=a===void 0?i:a,!t&&a>=i?e:Qt(e,t,a)}s(Xt,"u$4");zs(Xt,"castSlice");var Vs=Object.defineProperty,Us=s((e,t)=>Vs(e,"name",{value:t,configurable:!0}),"r$2"),Gs="\\ud800-\\udfff",Ks="\\u0300-\\u036f",Zs="\\ufe20-\\ufe2f",Qs="\\u20d0-\\u20ff",Xs=Ks+Zs+Qs,Ys="\\ufe0e\\ufe0f",ei="\\u200d",ti=RegExp("["+ei+Gs+Xs+Ys+"]");function Yt(e){return ti.test(e)}s(Yt,"b$3");Us(Yt,"hasUnicode");var ri=Object.defineProperty,ni=s((e,t)=>ri(e,"name",{value:t,configurable:!0}),"t$4");function er(e){return e.split("")}s(er,"e$3");ni(er,"asciiToArray");var ai=Object.defineProperty,si=s((e,t)=>ai(e,"name",{value:t,configurable:!0}),"e$2"),tr="\\ud800-\\udfff",ii="\\u0300-\\u036f",oi="\\ufe20-\\ufe2f",li="\\u20d0-\\u20ff",ui=ii+oi+li,fi="\\ufe0e\\ufe0f",ci="["+tr+"]",_e="["+ui+"]",Pe="\\ud83c[\\udffb-\\udfff]",gi="(?:"+_e+"|"+Pe+")",rr="[^"+tr+"]",nr="(?:\\ud83c[\\udde6-\\uddff]){2}",ar="[\\ud800-\\udbff][\\udc00-\\udfff]",pi="\\u200d",sr=gi+"?",ir="["+fi+"]?",hi="(?:"+pi+"(?:"+[rr,nr,ar].join("|")+")"+ir+sr+")*",di=ir+sr+hi,mi="(?:"+[rr+_e+"?",_e,nr,ar,ci].join("|")+")",yi=RegExp(Pe+"(?="+Pe+")|"+mi+di,"g");function or(e){return e.match(yi)||[]}s(or,"O$1");si(or,"unicodeToArray");var bi=Object.defineProperty,vi=s((e,t)=>bi(e,"name",{value:t,configurable:!0}),"o$1");function ke(e){return Yt(e)?or(e):er(e)}s(ke,"f$6");vi(ke,"stringToArray");var $i=Object.defineProperty,Oi=s((e,t)=>$i(e,"name",{value:t,configurable:!0}),"t$2"),Ti="__lodash_hash_undefined__";function lr(e){return this.__data__.set(e,Ti),this}s(lr,"h$3");Oi(lr,"setCacheAdd");var Ai=Object.defineProperty,wi=s((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"a$3");function ur(e){return this.__data__.has(e)}s(ur,"_");wi(ur,"setCacheHas");var ji=Object.defineProperty,_i=s((e,t)=>ji(e,"name",{value:t,configurable:!0}),"p$2");function se(e){var t=-1,a=e==null?0:e.length;for(this.__data__=new Z;++t<a;)this.add(e[t])}s(se,"o");_i(se,"SetCache");se.prototype.add=se.prototype.push=lr;se.prototype.has=ur;var Pi=Object.defineProperty,ki=s((e,t)=>Pi(e,"name",{value:t,configurable:!0}),"t$1");function fr(e,t){return e.has(t)}s(fr,"n$1");ki(fr,"cacheHas");var Si=Object.defineProperty,Ci=s((e,t)=>Si(e,"name",{value:t,configurable:!0}),"i$1");function cr(e){return Be(e)&&Nt(e)}s(cr,"m$3");Ci(cr,"isArrayLikeObject");var Ei=Object.defineProperty,Ni=s((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"l$2");function gr(e,t,a){for(var i=-1,f=e==null?0:e.length;++i<f;)if(a(t,e[i]))return!0;return!1}s(gr,"f$5");Ni(gr,"arrayIncludesWith");var Ri=Object.defineProperty,Wi=s((e,t)=>Ri(e,"name",{value:t,configurable:!0}),"c$3"),Ii=200;function pr(e,t,a,i){var f=-1,o=Pt,c=!0,r=e.length,h=[],l=t.length;if(!r)return h;a&&(t=He(t,Rt(a))),i?(o=gr,c=!1):t.length>=Ii&&(o=fr,c=!1,t=new se(t));e:for(;++f<r;){var y=e[f],m=a==null?y:a(y);if(y=i||y!==0?y:0,c&&m===m){for(var $=l;$--;)if(t[$]===m)continue e;h.push(y)}else o(t,m,i)||h.push(y)}return h}s(pr,"L$1");Wi(pr,"baseDifference");var Fi=Object.defineProperty,Bi=s((e,t)=>Fi(e,"name",{value:t,configurable:!0}),"d$2");function hr(e,t){for(var a=e.length;a--&&ve(t,e[a],0)>-1;);return a}s(hr,"f$4");Bi(hr,"charsEndIndex");var Hi=Object.defineProperty,qi=s((e,t)=>Hi(e,"name",{value:t,configurable:!0}),"r");function dr(e,t){for(var a=-1,i=e.length;++a<i&&ve(t,e[a],0)>-1;);return a}s(dr,"h$1");qi(dr,"charsStartIndex");var Li=Object.defineProperty,xi=s((e,t)=>Li(e,"name",{value:t,configurable:!0}),"e");function Se(e,t,a){if(e=Zt(e),e&&(a||t===void 0))return mt(e);if(!e||!(t=ye(t)))return e;var i=ke(e),f=ke(t),o=dr(i,f),c=hr(i,f)+1;return Xt(i,o,c).join("")}s(Se,"x");xi(Se,"trim");var Di=Ct(function(e,t){return cr(e)?pr(e,t):[]}),Ji=Object.defineProperty,Mi=s((e,t)=>Ji(e,"name",{value:t,configurable:!0}),"g");/**
|
|
11
|
+
* @name ranges-sort
|
|
12
|
+
* @fileoverview Sort string index ranges
|
|
13
|
+
* @version 6.1.0
|
|
14
|
+
* @author Roy Revelt
|
|
15
|
+
* @license MIT
|
|
16
|
+
* {@link https://codsen.com/os/ranges-sort/}
|
|
17
|
+
*/var zi={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function ie(e,t){if(!Array.isArray(e)||!e.length)return e;let a={...zi,...t},i,f;if(a.strictlyTwoElementsInRangeArrays&&!e.every((r,h)=>!Array.isArray(r)||r.length!==2?(i=h,f=r.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${i}th range (${JSON.stringify(e[i],null,4)}) has not two but ${f} elements!`);if(!e.every((r,h)=>!Array.isArray(r)||!Number.isInteger(r[0])||r[0]<0||!Number.isInteger(r[1])||r[1]<0?(i=h,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${i}th range (${JSON.stringify(e[i],null,4)}) does not consist of only natural numbers!`);let o=e.length**2,c=0;return Array.from(e).sort((r,h)=>(a.progressFn&&(c+=1,a.progressFn(Math.floor(c*100/o))),r[0]===h[0]?r[1]<h[1]?-1:r[1]>h[1]?1:0:r[0]<h[0]?-1:1))}s(ie,"m$2");Mi(ie,"g");var Vi=Object.defineProperty,Ce=s((e,t)=>Vi(e,"name",{value:t,configurable:!0}),"a$1"),tt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function mr(e,t){function a(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}if(s(a,"i"),Ce(a,"l"),!Array.isArray(e)||!e.length)return null;let i;if(t)if(a(t)){if(i={...tt,...t},i.progressFn&&a(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof i.progressFn}", equal to ${JSON.stringify(i.progressFn,null,4)}`);if(![1,2,"1","2"].includes(i.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof i.mergeType}", equal to ${JSON.stringify(i.mergeType,null,4)}`);if(typeof i.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof i.joinRangesThatTouchEdges}", equal to ${JSON.stringify(i.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
|
|
18
|
+
${JSON.stringify(t,null,4)} (type ${typeof t})`);else i={...tt};let f=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),o,c,r;i.progressFn?o=ie(f,{progressFn:Ce(l=>{r=Math.floor(l/5),r!==c&&(c=r,i.progressFn(r))},"progressFn")}):o=ie(f);let h=o.length-1;for(let l=h;l>0;l--)i.progressFn&&(r=Math.floor((1-l/h)*78)+21,r!==c&&r>c&&(c=r,i.progressFn(r))),(o[l][0]<=o[l-1][0]||!i.joinRangesThatTouchEdges&&o[l][0]<o[l-1][1]||i.joinRangesThatTouchEdges&&o[l][0]<=o[l-1][1])&&(o[l-1][0]=Math.min(o[l][0],o[l-1][0]),o[l-1][1]=Math.max(o[l][1],o[l-1][1]),o[l][2]!==void 0&&(o[l-1][0]>=o[l][0]||o[l-1][1]<=o[l][1])&&o[l-1][2]!==null&&(o[l][2]===null&&o[l-1][2]!==null?o[l-1][2]=null:o[l-1][2]!=null?+i.mergeType==2&&o[l-1][0]===o[l][0]?o[l-1][2]=o[l][2]:o[l-1][2]+=o[l][2]:o[l-1][2]=o[l][2]),o.splice(l,1),l=o.length);return o.length?o:null}s(mr,"m$1");Ce(mr,"b");var Ui=Object.defineProperty,Gi=s((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"i"),Ki="Invariant failed";function yr(e,t){if(!e)throw new Error(Ki)}s(yr,"u");Gi(yr,"invariant");var Zi=Object.defineProperty,br=s((e,t)=>Zi(e,"name",{value:t,configurable:!0}),"f$2");function vr(e,t,a){let i=0,f=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(a&&typeof a!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof a}, equal to: ${JSON.stringify(a,null,4)}`);if(!t?.filter(y=>y).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 c=o.length,r=0;o.filter(y=>y).forEach((y,m)=>{if(a&&(i=Math.floor(r/c*10),i!==f&&(f=i,a(i))),!Array.isArray(y))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${m}th element not an array: ${JSON.stringify(y,null,4)}, which is ${typeof y}`);if(!Number.isInteger(y[0])){if(!Number.isInteger(+y[0])||+y[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${m}th element, array ${JSON.stringify(y,null,0)}. Its first element is not an integer, string index, but ${typeof y[0]}, equal to: ${JSON.stringify(y[0],null,4)}.`);o[m][0]=+o[m][0]}if(!Number.isInteger(y[1])){if(!Number.isInteger(+y[1])||+y[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${m}th element, array ${JSON.stringify(y,null,0)}. Its second element is not an integer, string index, but ${typeof y[1]}, equal to: ${JSON.stringify(y[1],null,4)}.`);o[m][1]=+o[m][1]}r+=1});let h=mr(o,{progressFn:br(y=>{a&&(i=10+Math.floor(y/10),i!==f&&(f=i,a(i)))},"progressFn")});yr(h);let l=h.length;if(l>0){let y=e.slice(h[l-1][1]);e=h.reduce((m,$,u,d)=>{a&&(i=20+Math.floor(u/l*80),i!==f&&(f=i,a(i)));let T=u===0?0:d[u-1][1],O=d[u][0];return`${m}${e.slice(T,O)}${d[u][2]||""}`},""),e+=y}return e}s(vr,"N$1");br(vr,"_");var Qi=Object.defineProperty,Ee=s((e,t)=>Qi(e,"name",{value:t,configurable:!0}),"a");function pe(e,t=1){let a=" ";function i(o){return Array.from(o).reverse().join("")}s(i,"g"),Ee(i,"$");function f(o,c,r){let h=r?`
|
|
19
|
+
`:"\r",l=r?"\r":`
|
|
20
|
+
`;if(!o)return o;let y=0,m="";for(let $=0,u=o.length;$<u;$++)(o[$]===h||o[$]===l&&o[$-1]!==h)&&y++,`\r
|
|
21
|
+
`.includes(o[$])||o[$]===a?o[$]===a?m+=o[$]:o[$]===h?y<=c&&(m+=o[$],o[$+1]===l&&(m+=o[$+1],$++)):o[$]===l&&o?.[$-1]!==h&&y<=c&&(m+=o[$]):!o[$+1]&&!y&&(m+=" ");return m}if(s(f,"h"),Ee(f,"p"),typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let c="",r="";if(!e.trim())c=e;else if(!e[0].trim()){for(let h=0,l=e.length;h<l;h++)if(e[h].trim()){c=e.slice(0,h);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===a)){for(let h=e.length;h--;)if(e[h].trim()){r=e.slice(h+1);break}}return`${f(c,o,!1)}${e.trim()}${i(f(i(r),o,!0))}`}return e}s(pe,"y$1");Ee(pe,"D");var Xi=Object.defineProperty,he=s((e,t)=>Xi(e,"name",{value:t,configurable:!0}),"p$1"),rt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function $r(e,t){function a(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}if(s(a,"i"),he(a,"r"),!Array.isArray(e)||!e.length)return null;let i;if(t)if(a(t)){if(i={...rt,...t},i.progressFn&&a(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof i.progressFn}", equal to ${JSON.stringify(i.progressFn,null,4)}`);if(![1,2,"1","2"].includes(i.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof i.mergeType}", equal to ${JSON.stringify(i.mergeType,null,4)}`);if(typeof i.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof i.joinRangesThatTouchEdges}", equal to ${JSON.stringify(i.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:
|
|
22
|
+
${JSON.stringify(t,null,4)} (type ${typeof t})`);else i={...rt};let f=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),o,c,r;i.progressFn?o=ie(f,{progressFn:he(l=>{r=Math.floor(l/5),r!==c&&(c=r,i.progressFn!=null&&i.progressFn(r))},"progressFn")}):o=ie(f);let h=o.length-1;for(let l=h;l>0;l--)i.progressFn&&(r=Math.floor((1-l/h)*78)+21,r!==c&&r>c&&(c=r,i.progressFn(r))),(o[l][0]<=o[l-1][0]||!i.joinRangesThatTouchEdges&&o[l][0]<o[l-1][1]||i.joinRangesThatTouchEdges&&o[l][0]<=o[l-1][1])&&(o[l-1][0]=Math.min(o[l][0],o[l-1][0]),o[l-1][1]=Math.max(o[l][1],o[l-1][1]),o[l][2]!==void 0&&(o[l-1][0]>=o[l][0]||o[l-1][1]<=o[l][1])&&o[l-1][2]!==null&&(o[l][2]===null&&o[l-1][2]!==null?o[l-1][2]=null:o[l-1][2]!=null?+(i||{})?.mergeType==2&&o[l-1][0]===o[l][0]?o[l-1][2]=o[l][2]:o[l-1][2]+=o[l][2]:o[l-1][2]=o[l][2]),o.splice(l,1),l=o.length);return o.length?o:null}s($r,"A$1");he($r,"f");var Yi={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},eo=class{static{s(this,"$")}static{he(this,"$")}constructor(e){let t={...Yi,...e};if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(k(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(k(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=[]}ranges;opts;add(e,t,a){if(e==null&&t==null)return;if(x(e)&&!x(t)){if(Array.isArray(e)){if(e.length){if(e.some(o=>Array.isArray(o))){e.forEach(o=>{Array.isArray(o)&&this.add(...o)});return}e.length&&D(+e[0])&&D(+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(!x(e)&&x(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 i=+e,f=+t;if(D(i)&&D(f)){if(x(a)&&!k(a)&&!ot(a))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof a}, equal to:
|
|
23
|
+
${JSON.stringify(a,null,4)}`);if(x(this.ranges)&&Array.isArray(this.last())&&i===this.last()[1]){if(this.last()[1]=f,this.last()[2],this.last()[2]!==null&&x(a)){let o=this.last()[2]&&this.last()[2].length&&(!this.opts?.mergeType||this.opts.mergeType===1)?`${this.last()[2]}${a}`:a;this.opts.limitToBeAddedWhitespace&&(o=pe(o,this.opts.limitLinebreaksCount)),k(o)&&!o.length||(this.last()[2]=o)}}else{this.ranges||(this.ranges=[]);let o=a!==void 0&&!(k(a)&&!a.length)?[i,f,a&&this.opts.limitToBeAddedWhitespace?pe(a,this.opts.limitLinebreaksCount):a]:[i,f];this.ranges.push(o)}}else throw D(i)&&i>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof f}" equal to: ${JSON.stringify(f,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof i}" equal to: ${JSON.stringify(i,null,4)}`)}push(e,t,a){this.add(e,t,a)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=$r(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>x(e[2])?[e[0],e[1],pe(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])&&D(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}},to=Object.defineProperty,E=s((e,t)=>to(e,"name",{value:t,configurable:!0}),"f$1"),M=st(),X=" ";function Or(e){let t={value:e,hungry:!1,optional:!1};return(t.value.endsWith("?*")||t.value.endsWith("*?"))&&t.value.length>2?(t.value=t.value.slice(0,t.value.length-2),t.optional=!0,t.hungry=!0):t.value.endsWith("?")&&t.value.length>1?(t.value=t.value.slice(0,~-t.value.length),t.optional=!0):t.value.endsWith("*")&&t.value.length>1&&(t.value=t.value.slice(0,~-t.value.length),t.hungry=!0),t}s(Or,"O");E(Or,"J");function $e({str:e,idx:t=0,stopAtNewlines:a=!1,stopAtRawNbsp:i=!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()||a&&`
|
|
24
|
+
\r`.includes(e[t+1])||i&&e[t+1]===X))return t+1;if(e[t+2]&&(e[t+2].trim()||a&&`
|
|
25
|
+
\r`.includes(e[t+2])||i&&e[t+2]===X))return t+2;for(let f=t+1,o=e.length;f<o;f++)if(e[f].trim()||a&&`
|
|
26
|
+
\r`.includes(e[f])||i&&e[f]===X)return f;return null}s($e,"N");E($e,"D");function N(e,t=0){return $e({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}s(N,"y");E(N,"E");function ro(e,t){return $e({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}s(ro,"H");E(ro,"k");function no(e,t){return $e({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}s(no,"T");E(no,"M");function Oe({str:e,idx:t,stopAtNewlines:a,stopAtRawNbsp:i}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||a&&`
|
|
27
|
+
\r`.includes(e[~-t])||i&&e[~-t]===X))return~-t;if(e[t-2]&&(e[t-2].trim()||a&&`
|
|
28
|
+
\r`.includes(e[t-2])||i&&e[t-2]===X))return t-2;for(let f=t;f--;)if(e[f]&&(e[f].trim()||a&&`
|
|
29
|
+
\r`.includes(e[f])||i&&e[f]===X))return f;return null}s(Oe,"R");E(Oe,"V");function de(e,t=0){return Oe({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}s(de,"b");E(de,"y");function ao(e,t){return Oe({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}s(ao,"j");E(ao,"W");function so(e,t){return Oe({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}s(so,"P");E(so,"_");function De(e,t,a,i,f){if(typeof t!="string"||!t.length||(typeof a!="number"&&(a=0),e==="right"&&!t[a+1]||e==="left"&&!t[~-a]))return null;let o=a,c=[],r,h,l,y=0;for(;y<f.length;){if(!k(f[y])||!f[y].length){y+=1;continue}let{value:m,optional:$,hungry:u}=Or(f[y]),d=e==="right"?N(t,o):de(t,o);if(i.i&&t[d].toLowerCase()===m.toLowerCase()||!i.i&&t[d]===m){let T=e==="right"?N(t,d):de(t,d);u&&(i.i&&t[T].toLowerCase()===m.toLowerCase()||!i.i&&t[T]===m)?l=!0:y+=1,typeof d=="number"&&e==="right"&&d>o+1?c.push([o+1,d]):e==="left"&&typeof d=="number"&&d<~-o&&c.unshift([d+1,o]),o=d,e==="right"?(r===void 0&&(r=d),h=d):(h===void 0&&(h=d),r=d)}else if($){y+=1;continue}else if(l){y+=1,l=void 0;continue}else return null}return r===void 0||h===void 0?null:{gaps:c,leftmostChar:r,rightmostChar:h}}s(De,"I$1");E(De,"O");var me={i:!1};function Tr(e,t,...a){if(!a?.length)throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let i;return F(a[0])?i={...me,...a.shift()}:i=me,De("left",e,t,i,Array.from(a).reverse())}s(Tr,"L");E(Tr,"L");function Ar(e,t,...a){if(!a?.length)throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let i;return F(a[0])?i={...me,...a.shift()}:i=me,De("right",e,t,i,a)}s(Ar,"C");E(Ar,"A");function G(e,t,a,i,f=[]){if(typeof t!="string"||!t.length||((!a||typeof a!="number")&&(a=0),e==="right"&&!t[a+1]||e==="left"&&+a==0))return null;let o=null,c=null;do o=e==="right"?Ar(t,typeof c=="number"?c:a,...f):Tr(t,typeof c=="number"?c:a,...f),o!==null&&(c=e==="right"?o.rightmostChar:o.leftmostChar);while(o);if(c!=null&&e==="right"&&(c+=1),c===null)return null;if(e==="right"){if(t[c]?.trim())return c;let h=N(t,c);if(!i||i.mode===0){if(h===c+1)return c;if(t.slice(c,h||t.length).trim()||t.slice(c,h||t.length).includes(`
|
|
30
|
+
`)||t.slice(c,h||t.length).includes("\r")){for(let l=c,y=t.length;l<y;l++)if(`
|
|
31
|
+
\r`.includes(t[l]))return l}else return h?~-h:t.length}else{if(i.mode===1)return c;if(i.mode===2){let l=t.slice(c);if(l.trim()||l.includes(`
|
|
32
|
+
`)||l.includes("\r")){for(let y=c,m=t.length;y<m;y++)if(t[y].trim()||`
|
|
33
|
+
\r`.includes(t[y]))return y}return t.length}}return h||t.length}if(t[c]&&t[~-c]?.trim())return c;let r=de(t,c);if(!i||i.mode===0){if(r===c-2)return c;if(t.slice(0,c).trim()||t.slice(0,c).includes(`
|
|
34
|
+
`)||t.slice(0,c).includes("\r")){for(let h=c;h--;)if(`
|
|
35
|
+
\r`.includes(t[h])||t[h].trim())return h+1+(t[h].trim()?1:0)}return 0}if(i.mode===1)return c;if(i.mode===2){let h=t.slice(0,c);if(h.trim()||h.includes(`
|
|
36
|
+
`)||h.includes("\r")){for(let l=c;l--;)if(t[l].trim()||`
|
|
37
|
+
\r`.includes(t[l]))return l+1}return 0}return r!==null?r+1:0}s(G,"c");E(G,"h");function io(e,t,...a){if(!a.length||a.length===1&&F(a[0]))return null;let i={mode:0};if(F(a[0])){let f={...i,...M(a[0])};if(!f.mode)f.mode=0;else if(k(f.mode)&&f.mode.length===1&&"0123".includes(f.mode))f.mode=+f.mode;else if(!D(f.mode))throw new Error(`string-left-right/chompLeft(): [THROW_ID_01] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ${f.mode} (type ${typeof f.mode})`);return G("left",e,t,f,M(a).slice(1))}return k(a[0])?G("left",e,t,i,M(a)):G("left",e,t,i,M(a).slice(1))}s(io,"k");E(io,"H");function oo(e,t,...a){if(!a.length||a.length===1&&F(a[0]))return null;let i={mode:0};if(F(a[0])){let f={...i,...M(a[0])};if(!f.mode)f.mode=0;else if(k(f.mode)&&"0123".includes(f.mode))f.mode=Number.parseInt(f.mode,10);else if(!D(f.mode))throw new Error(`string-left-right/chompRight(): [THROW_ID_02] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ${f.mode} (type ${typeof f.mode})`);return G("right",e,t,f,M(a).slice(1))}return k(a[0])?G("right",e,t,i,M(a)):G("right",e,t,i,M(a).slice(1))}s(oo,"J");E(oo,"P");var lo=Object.defineProperty,R=s((e,t)=>lo(e,"name",{value:t,configurable:!0}),"f");function wr(e){return/[-_A-Za-z0-9]/.test(e)}s(wr,"he");R(wr,"ee");function Ne(e,t){if(!e)return[];if(Array.isArray(e))return e.filter(a=>typeof a=="string"&&a.trim());if(typeof e=="string")return e.trim()?[e]:[];throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_05] ${t} must be array containing zero or more strings or something falsey. Currently it's equal to: ${e}, that a type of ${typeof e}.`)}s(Ne,"ne");R(Ne,"G");function ne(e,t,a,i){for(let f=t,o=e.length;f<o;f++){if(e.startsWith(a,f))return!0;if(e.startsWith(i,f))return!1}return!1}s(ne,"D");R(ne,"j");function Re(e,t,a){return e?.quotes?.value&&ne(t,a+1,e.quotes.value,">"),ne(t,e?.quotes?.next-1,e?.quotes?.value,">"),!e?.quotes||!ne(t,a+1,e.quotes.value,">")&&e?.quotes?.next!==-1&&ne(t,e?.quotes?.next-1,e?.quotes?.value,">")}s(Re,"re");R(Re,"Y");function jr(e,t){return(t.match(new RegExp(e,"g"))||[]).length}s(jr,"de");R(jr,"ne");var re=new Set(["!doctype","abbr","address","area","article","aside","audio","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","param","picture","pre","progress","rb","rp","rt","rtc","ruby","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","ul","var","video","wbr","xml"]),we=new Set(["a","b","i","p","q","s","u"]),je=new Set([".",",",";","!","?"]),nt=new Set([".",",","?",";",")","…",'"',"»"]),uo=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]),fo="13.5.0",ho=fo,at={ignoreTags:[],ignoreTagsWithTheirContents:[],onlyStripTags:[],stripTogetherWithTheirContents:["script","style","xml"],skipHtmlDecoding:!1,trimOnlySpaces:!1,stripRecognisedHTMLOnly:!1,dumpLinkHrefsNearby:{enabled:!1,putOnNewLine:!1,wrapHeads:"",wrapTails:""},ignoreIndentations:!1,cb:null,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100};function _r(e,t){let a=Date.now(),i=[],f=[],o=[],c=[],r={};function h(){r={attributes:[]}}s(h,"ie"),R(h,"re"),h();let l=null,y=null,m=null,$=!1,u={},d={tagName:"",hrefValue:"",openingTagEnds:void 0},T="",O=!1,P=null,W=!0;function C(n,p,v){if(Array.isArray(p.stripTogetherWithTheirContents)&&(p.stripTogetherWithTheirContents.includes(r.name)||p.stripTogetherWithTheirContents.includes("*")))if(r.slashPresent&&Array.isArray(i)&&i.some(b=>b.name===r.name)){for(let b=i.length;b--;)if(i[b].name===r.name){c=c.filter(([w,S])=>(w<i[b].lastOpeningBracketAt||w>=n+1)&&(S<=i[b].lastOpeningBracketAt||S>n+1));let j=n+1;r.lastClosingBracketAt&&(j=r.lastClosingBracketAt+1),c.push([i[b].lastOpeningBracketAt,j]),nt.has(e[n])&&p.cb?p.cb({tag:r,deleteFrom:i[b].lastOpeningBracketAt,deleteTo:n+1,insert:null,rangesArr:v,proposedReturn:[i[b].lastOpeningBracketAt,n,null]}):p.cb&&p.cb({tag:r,deleteFrom:i[b].lastOpeningBracketAt,deleteTo:n,insert:"",rangesArr:v,proposedReturn:[i[b].lastOpeningBracketAt,n,""]}),i.splice(b,1);break}}else r.slashPresent||i.push(r);else Array.isArray(p.ignoreTagsWithTheirContents)&&fe(n,p,r)&&(W=!1)}s(C,"_"),R(C,"v");function B(n,p,v,b,j,w){if(Array.isArray(A.current())&&typeof v=="number"&&A.current()[0][0]===0&&A.current()[0][1]>=v)return"";if(e.length===b&&w&&!g?.dumpLinkHrefsNearby?.enabled)return null;let S="";if(Number.isInteger(v)&&v<j&&(S+=n.slice(v,j)),Number.isInteger(b)&&b>w+1){let L=n.slice(w+1,b);b&&!N(e,b-1)&&(L=L.trimEnd()),L.includes(`
|
|
38
|
+
`)&&H(b,n)?S+=" ":S+=L}let Q=!nt.has(n[p]),ze=n[b-1]!==">"||!n[v].trim(),Ve=!['"',"("].includes(n[j-1]),kr=![";",".",":","!"].includes(n[p]);if((Q||ze&&Ve&&kr)&&(ze||Ve)&&n[p]!=="!"&&(!uo.has(r.name)||typeof v=="number"&&v<j||typeof b=="number"&&b>w+1)){let L=S.match(/\n/g);return Array.isArray(L)&&L.length?L.length===1?`
|
|
39
|
+
`:L.length===2?`
|
|
40
|
+
|
|
41
|
+
`:`
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
`:" "}return""}s(B,"F"),R(B,"L");function ue(n,p){if(n.dumpLinkHrefsNearby?.enabled&&d.tagName&&d.tagName===r.name&&r.lastOpeningBracketAt&&(d.openingTagEnds&&r.lastOpeningBracketAt>d.openingTagEnds||!d.openingTagEnds)&&(O=!0),O){let v=n.dumpLinkHrefsNearby?.putOnNewLine?`
|
|
45
|
+
|
|
46
|
+
`:"";T=`${v}${d.hrefValue}`,(typeof p!="number"||N(e,p-1))&&(T+=v)}}s(ue,"M"),R(ue,"U");function H(n,p){return p?p[n]==="<"&&p[n+1]!=="%":e[n]==="<"&&e[n+1]!=="%"}s(H,"B"),R(H,"S");function q(n){return e[n]===">"&&e[n-1]!=="%"}s(q,"W"),R(q,"A");function fe(n,p,v){if(p.ignoreTagsWithTheirContents.includes("*"))return!0;let b=e.indexOf(`<${v.name}`,n),j=e.indexOf(`</${v.name}`,n);return!v.slashPresent&&j===-1||v.slashPresent&&!f.some(w=>w.name===v.name)||j>-1&&b>-1&&b<j?!1:p.ignoreTagsWithTheirContents.includes(v.name)}if(s(fe,"J"),R(fe,"M"),typeof e!="string")throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_01] Input must be string! Currently it's: ${(typeof e).toLowerCase()}, equal to:
|
|
47
|
+
${JSON.stringify(e,null,4)}`);if(t)if(F(t)){if(t.reportProgressFunc&&typeof t.reportProgressFunc!="function")throw new Error(`string-strip-html/stripHtml(): [THROW_ID_03] The Optional Options Object's key reportProgressFunc, callback function, should be a function but it was given as type ${typeof t.reportProgressFunc}, equal to ${JSON.stringify(t.reportProgressFunc,null,4)}`);if(typeof t.dumpLinkHrefsNearby=="boolean"&&t.dumpLinkHrefsNearby!=null)throw new Error(`string-strip-html/stripHtml(): [THROW_ID_04] The Optional Options Object's key should be a plain object but it was given as type ${typeof t.dumpLinkHrefsNearby}, equal to ${JSON.stringify(t.dumpLinkHrefsNearby,null,4)}`)}else throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_02] Optional Options Object must be a plain object! Currently it's: ${(typeof t).toLowerCase()}, equal to:
|
|
48
|
+
${JSON.stringify(t,null,4)}`);function ce(){O&&(d={tagName:"",hrefValue:"",openingTagEnds:void 0},O=!1)}s(ce,"V$1"),R(ce,"_");let g={...at,...t,dumpLinkHrefsNearby:Object.assign({},at.dumpLinkHrefsNearby,t?.dumpLinkHrefsNearby)};if(ft(g,"returnRangesOnly"))throw new TypeError("string-strip-html/stripHtml(): [THROW_ID_05] The Optional Options Object's key returnRangesOnly has been removed from the API since v.5 release.");if(g.reportProgressFunc){if(typeof g.reportProgressFuncFrom!="number")throw new Error(`string-strip-html/stripHtml(): [THROW_ID_06] The Optional Options Object's key reportProgressFuncFrom, callback function's "from" range, should be a number but it was given as type ${typeof g.reportProgressFuncFrom}, equal to ${JSON.stringify(g.reportProgressFuncFrom,null,4)}`);if(typeof g.reportProgressFuncTo!="number")throw new Error(`string-strip-html/stripHtml(): [THROW_ID_07] The Optional Options Object's key reportProgressFuncTo, callback function's "to" range, should be a number but it was given as type ${typeof g.reportProgressFuncTo}, equal to ${JSON.stringify(g.reportProgressFuncTo,null,4)}`)}g.ignoreTags=Ne(g.ignoreTags,"resolvedOpts.ignoreTags"),g.onlyStripTags=Ne(g.onlyStripTags,"resolvedOpts.onlyStripTags");let Je=!!g.onlyStripTags.length;g.onlyStripTags.length&&g.ignoreTags.length&&(g.onlyStripTags=Di(g.onlyStripTags,...g.ignoreTags)),g.stripTogetherWithTheirContents?typeof g.stripTogetherWithTheirContents=="string"&&g.stripTogetherWithTheirContents.length&&(g.stripTogetherWithTheirContents=[g.stripTogetherWithTheirContents]):g.stripTogetherWithTheirContents=[];let ee={};if(g.stripTogetherWithTheirContents&&Array.isArray(g.stripTogetherWithTheirContents)&&g.stripTogetherWithTheirContents.length&&!g.stripTogetherWithTheirContents.every((n,p)=>typeof n!="string"?(ee.el=n,ee.i=p,!1):!0))throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_08] Optional Options Object's key stripTogetherWithTheirContents was set to contain not just string elements! For example, element at index ${ee.i} has a value ${ee.el} which is not string but ${(typeof ee.el).toLowerCase()}.`);g.cb||(g.cb=({rangesArr:n,proposedReturn:p})=>{p&&n.push(...p)});let A=new eo({limitToBeAddedWhitespace:!0,limitLinebreaksCount:2});if(!g.skipHtmlDecoding)for(;e!==Ue(e,{scope:"strict"});)e=Ue(e,{scope:"strict"});let V=!1,J=!1,ge=0,Me=0,I=e.length,Pr=Math.floor(I/2);for(let n=0;n<I;n++){if(g.reportProgressFunc&&(I>1e3&&I<2e3?n===Pr&&g.reportProgressFunc(Math.floor((g.reportProgressFuncTo-g.reportProgressFuncFrom)/2)):I>=2e3&&(ge=g.reportProgressFuncFrom+Math.floor(n/I*(g.reportProgressFuncTo-g.reportProgressFuncFrom)),ge!==Me&&(Me=ge,g.reportProgressFunc(ge)))),Object.keys(r).length>1&&r.lastClosingBracketAt&&r.lastClosingBracketAt<n&&e[n]!==" "&&P===null&&(P=n),!V&&e[n]==="%"&&e[n-1]==="{"&&e.includes("%}",n+1)){m=null;let p=e.indexOf("%}",n)-1;if(p>n){n=p;continue}}if(!V&&q(n)&&(!r||Object.keys(r).length<2)&&n>1){for(let p=n;p--;)if(e[p-1]===void 0||q(p)){let v=e[p-1]===void 0?p:p+1,b=e.slice(v,n+1)||"";if((b.includes("/>")||b.includes("/ >")||b.includes('="')||b.includes("='"))&&e!==`<${Se(b.trim(),"/>")}>`&&[...re].some(j=>Se(b.trim().split(/\s+/).filter(w=>w.trim()).filter((w,S)=>S===0),"/>").toLowerCase()===j)&&_r(`<${b.trim()}>`,g).result===""){(!o.length||o[o.length-1][0]!==r.lastOpeningBracketAt)&&o.push([v,n+1]),(!c.length||c[c.length-1][0]!==r.lastOpeningBracketAt)&&c.push([v,n+1]);let j=B(e,n,v,n+1,v,n+1),w=n+1;if(e[w]&&!e[w].trim()){for(let S=w;S<I;S++)if(e[S].trim()){w=S;break}}g.cb({tag:r,deleteFrom:v,deleteTo:w,insert:j,rangesArr:A,proposedReturn:[v,w,j]})}break}}if(!J&&e[n]==="/"&&!r.quotes?.value&&Number.isInteger(r.lastOpeningBracketAt)&&!Number.isInteger(r.lastClosingBracketAt)&&(r.slashPresent=n),e[n]==='"'||e[n]==="'")if(!J&&r.nameStarts&&r?.quotes?.value===e[n])if(u.valueStarts===void 0)u={},delete r.quotes;else{u.valueEnds=n,u.value=e.slice(u.valueStarts,n),r.attributes.push(u),u={},delete r.quotes;let p;g.dumpLinkHrefsNearby?.enabled&&!i.length&&r.attributes.some(v=>{if(typeof v.name=="string"&&v.name.toLowerCase()==="href")return p=`${g.dumpLinkHrefsNearby?.wrapHeads||""}${v.value}${g.dumpLinkHrefsNearby?.wrapTails||""}`,!0})&&(d={tagName:r.name,hrefValue:p,openingTagEnds:void 0})}else!J&&!r.quotes&&r.nameStarts&&(r.quotes={},r.quotes.value=e[n],r.quotes.start=n,r.quotes.next=e.indexOf(e[n],n+1),u.nameStarts&&u.nameEnds&&u.nameEnds<n&&u.nameStarts<n&&!u.valueStarts&&(u.name=e.slice(u.nameStarts,u.nameEnds)));if(r.nameStarts!==void 0&&r.nameEnds===void 0&&(!e[n].trim()||!wr(e[n]))){if(r.nameEnds=n,r.name=e.slice(r.nameStarts,r.nameEnds+(!q(n)&&e[n]!=="/"&&e[n+1]===void 0?1:0)),e[r.nameStarts-1]!=="!"&&!r.name.replace(/-/g,"").length||/^\d+$/.test(r.name[0])){r={};continue}if(typeof r.name=="string"&&r.name.toLowerCase()==="doctype"&&(J=!0),H(n)){ue(g);let p=B(e,n,r.leftOuterWhitespace,n,r.lastOpeningBracketAt,n);(g.stripTogetherWithTheirContents.includes(r.name)||g.stripTogetherWithTheirContents.includes("*"))&&(c=c.filter(([v,b])=>!(v===r.leftOuterWhitespace&&b===n))),g.cb({tag:r,deleteFrom:r.leftOuterWhitespace,deleteTo:n,insert:`${p}${T}${p}`,rangesArr:A,proposedReturn:[r.leftOuterWhitespace,n,`${p}${T}${p}`]}),ce(),C(n,g,A)}}if(r.quotes?.start&&r.quotes.start<n&&!r.quotes.end&&u.nameEnds&&u.equalsAt&&!u.valueStarts&&(u.valueStarts=n),!r.quotes&&u.nameEnds&&e[n]==="="&&!u.valueStarts&&!u.equalsAt&&(u.equalsAt=n),!r.quotes&&u.nameStarts&&u.nameEnds&&!u.valueStarts&&e[n].trim()&&e[n]!=="="&&(r.attributes.push(u),u={}),!r.quotes&&u.nameStarts&&!u.nameEnds&&(J&&`'"`.includes(e[u.nameStarts])?u.nameStarts<n&&e[n]===e[u.nameStarts]&&(u.nameEnds=n+1,u.name=e.slice(u.nameStarts,u.nameEnds)):e[n].trim()?e[n]==="="?u.equalsAt||(u.nameEnds=n,u.equalsAt=n,u.name=e.slice(u.nameStarts,u.nameEnds)):e[n]==="/"||q(n)?(u.nameEnds=n,u.name=e.slice(u.nameStarts,u.nameEnds),r.attributes.push(u),u={}):H(n)&&(u.nameEnds=n,u.name=e.slice(u.nameStarts,u.nameEnds),r.attributes.push(u),u={}):(u.nameEnds=n,u.name=e.slice(u.nameStarts,u.nameEnds))),!r.quotes&&r.nameEnds<n&&!e[n-1].trim()&&e[n].trim()&&!"<>/!".includes(e[n])&&!u.nameStarts&&!r.lastClosingBracketAt&&(u.nameStarts=n),r.lastOpeningBracketAt!==null&&r.lastOpeningBracketAt<n&&e[n]==="/"&&r.onlyPlausible&&(r.onlyPlausible=!1),r.lastOpeningBracketAt!==null&&r.lastOpeningBracketAt<n&&e[n]!=="/"&&(r.onlyPlausible===void 0&&((!e[n].trim()||H(n))&&!r.slashPresent?r.onlyPlausible=!0:r.onlyPlausible=!1),e[n].trim()&&r.nameStarts===void 0&&!H(n)&&e[n]!=="/"&&!q(n)&&e[n]!=="!"&&(r.nameStarts=n,r.nameContainsLetters=!1)),r.nameStarts&&!r.quotes&&typeof e[n]=="string"&&e[n].toLowerCase()!==e[n].toUpperCase()&&(r.nameContainsLetters=!0),q(n)&&(Re(r,e,n)||r.quotes.value&&typeof r.lastOpeningBracketAt=="number"&&jr(r.quotes.value,e.slice(r.lastOpeningBracketAt,n))%2===1&&!e.slice(r.lastOpeningBracketAt+1,n).includes("<")&&!e.slice(r.lastOpeningBracketAt+1,n).includes(">"))&&r.lastOpeningBracketAt!==void 0&&(r.lastClosingBracketAt=n,P=null,Object.keys(u).length&&(r.attributes.push(u),u={}),g.dumpLinkHrefsNearby?.enabled&&d.tagName&&!d.openingTagEnds&&(d.openingTagEnds=n)),(!J||e[n]===">")&&r.lastOpeningBracketAt!==void 0){if(r.lastClosingBracketAt===void 0){if(r.lastOpeningBracketAt<n&&!H(n)&&(e[n+1]===void 0||H(n+1)&&!r?.quotes?.value)&&r.nameContainsLetters&&typeof r.nameStarts=="number"){if(r.name=e.slice(r.nameStarts,r.nameEnds||n+1).toLowerCase(),(!o.length||o[o.length-1][0]!==r.lastOpeningBracketAt)&&o.push([r.lastOpeningBracketAt,n+1]),g.ignoreTags.includes(r.name)||fe(n,g,r)||!re.has(r.name)&&(r.onlyPlausible||g.stripRecognisedHTMLOnly)){r={},u={};continue}if((re.has(r.name)||we.has(r.name))&&(r.onlyPlausible===!1||r.onlyPlausible===!0&&r.attributes.length)||e[n+1]===void 0){ue(g);let p=B(e,n,r.leftOuterWhitespace,n+1,r.lastOpeningBracketAt,r.lastClosingBracketAt);V&&r.name==="script"&&r.slashPresent&&(V=!1);let v;p===null||T===null?v=null:v=`${p}${T}${p}`,g.cb({tag:r,deleteFrom:r.leftOuterWhitespace,deleteTo:n+1,insert:v,rangesArr:A,proposedReturn:[r.leftOuterWhitespace,n+1,v]}),ce(),C(n,g,A)}if(!c.length||c[c.length-1][0]!==r.lastOpeningBracketAt&&c[c.length-1][1]!==n+1)if(g.stripTogetherWithTheirContents.includes(r.name)||g.stripTogetherWithTheirContents.includes("*")){let p;for(let v=i.length;v--;)i[v].name===r.name&&(p=i[v]);p?(c=c.filter(([v])=>v!==p.lastOpeningBracketAt),c.push([p.lastOpeningBracketAt,n+1])):c.push([r.lastOpeningBracketAt,n+1])}else c.push([r.lastOpeningBracketAt,n+1])}}else if(n>r.lastClosingBracketAt&&e[n].trim()||e[n+1]===void 0||g.ignoreIndentations&&`\r
|
|
49
|
+
`.includes(e[n])){let p=r.lastClosingBracketAt===n?n+1:n;g.trimOnlySpaces&&p===I-1&&P!==null&&P<n&&(p=P),(!o.length||o[o.length-1][0]!==r.lastOpeningBracketAt)&&o.push([r.lastOpeningBracketAt,r.lastClosingBracketAt+1]);let v=g.ignoreTags.includes(r.name),b=fe(n,g,r);if(!W||g.stripRecognisedHTMLOnly&&typeof r.name=="string"&&!re.has(r.name.toLowerCase())&&!we.has(r.name.toLowerCase())||!Je&&(v||b)||Je&&!g.onlyStripTags.includes(r.name)||g.ignoreTagsWithTheirContents.includes(r.name)){if(b)if(r.slashPresent){for(let j=f.length;j--;)if(f[j].name===r.name){f.splice(j,1);break}f.length||(W=!0)}else W&&(W=!1),f.push(r);g.cb({tag:r,deleteFrom:null,deleteTo:null,insert:null,rangesArr:A,proposedReturn:null}),r={},u={}}else if(!r.onlyPlausible||r.attributes.length===0&&r.name&&(re.has(r.name.toLowerCase())||we.has(r.name.toLowerCase()))||r.attributes?.some(j=>j.equalsAt)){(!c.length||c[c.length-1][0]!==r.lastOpeningBracketAt)&&c.push([r.lastOpeningBracketAt,r.lastClosingBracketAt+1]);let j=B(e,n,r.leftOuterWhitespace,p,r.lastOpeningBracketAt,r.lastClosingBracketAt);T="",O=!1,ue(g,p);let w;typeof T=="string"&&T.length?(w=`${j}${T}${j===`
|
|
50
|
+
|
|
51
|
+
`?`
|
|
52
|
+
`:j}`,p===r.lastClosingBracketAt+1&&(!e[p]||!je.has(e[p]))&&(w+=" "),r.leftOuterWhitespace===r.lastOpeningBracketAt&&A.last()&&A.last()[1]<r.lastOpeningBracketAt&&(!g?.dumpLinkHrefsNearby?.putOnNewLine||!je.has(e[p]))&&(w=" "+w)):w=j,w!==null&&(r.leftOuterWhitespace===0||!N(e,p-1))&&(!g.dumpLinkHrefsNearby?.enabled||r.name!=="a")&&(w=void 0);let S=0;if(O&&je.has(e[p])){g.dumpLinkHrefsNearby?.putOnNewLine&&(w=`${e[p]}${w||""}`);let Q=N(e,p);Q&&w?.endsWith(`
|
|
53
|
+
`)?S+=Q-n:(!Q||Q>n)&&S++}g.cb({tag:r,deleteFrom:r.leftOuterWhitespace,deleteTo:p+S,insert:w,rangesArr:A,proposedReturn:[r.leftOuterWhitespace,p+S,w]}),ce(),C(n,g,A)}else r={};q(n)||(r={})}J&&(J=!1)}if((!V||e[n]==="<"&&N(e,N(e,n))&&e[N(e,n)]==="/"&&e.startsWith("script",N(e,N(e,n))))&&H(n)&&!H(n-1)&&!`'"`.includes(e[n+1])&&(!`'"`.includes(e[n+2])||/\w/.test(e[n+1]))&&!(e[n+1]==="c"&&e[n+2]===":")&&!(e[n+1]==="f"&&e[n+2]==="m"&&e[n+3]==="t"&&e[n+4]===":")&&!(e[n+1]==="s"&&e[n+2]==="q"&&e[n+3]==="l"&&e[n+4]===":")&&!(e[n+1]==="x"&&e[n+2]===":")&&!(e[n+1]==="f"&&e[n+2]==="n"&&e[n+3]===":")&&Re(r,e,n)){if(q(N(e,n)))continue;if(r.nameEnds&&r.nameEnds<n&&!r.lastClosingBracketAt&&(r.onlyPlausible===!0&&r.attributes?.length||r.onlyPlausible===!1)){let p=B(e,n,r.leftOuterWhitespace,n,r.lastOpeningBracketAt,n);g.cb({tag:r,deleteFrom:r.leftOuterWhitespace,deleteTo:n,insert:p,rangesArr:A,proposedReturn:[r.leftOuterWhitespace,n,p]}),C(n,g,A),r={},u={}}if(r.lastOpeningBracketAt!==void 0&&r.onlyPlausible&&r.name&&!r.quotes&&(r.lastOpeningBracketAt=void 0,r.name=void 0,r.onlyPlausible=!1),(r.lastOpeningBracketAt===void 0||!r.onlyPlausible)&&!r.quotes&&(r.lastOpeningBracketAt=n,r.slashPresent=!1,r.attributes=[],l===null?r.leftOuterWhitespace=n:g.trimOnlySpaces&&l===0?r.leftOuterWhitespace=y||n:r.leftOuterWhitespace=l,`${e[n+1]}${e[n+2]}${e[n+3]}`=="!--"||`${e[n+1]}${e[n+2]}${e[n+3]}${e[n+4]}${e[n+5]}${e[n+6]}${e[n+7]}${e[n+8]}`=="![CDATA[")){let p=!0;e[n+2]==="-"&&(p=!1);let v;for(let b=n;b<I;b++)if((!v&&p&&`${e[b-2]}${e[b-1]}${e[b]}`=="]]>"||!p&&`${e[b-2]}${e[b-1]}${e[b]}`=="-->")&&(v=b),v&&(v<b&&e[b].trim()||e[b+1]===void 0)){let j=b;(e[b+1]===void 0&&!e[b].trim()||e[b]===">")&&(j+=1),(!o.length||o[o.length-1][0]!==r.lastOpeningBracketAt)&&o.push([r.lastOpeningBracketAt,v+1]),(!c.length||c[c.length-1][0]!==r.lastOpeningBracketAt)&&c.push([r.lastOpeningBracketAt,v+1]);let w=B(e,b,r.leftOuterWhitespace,j,r.lastOpeningBracketAt,v);g.cb({tag:r,deleteFrom:r.leftOuterWhitespace,deleteTo:j,insert:w,rangesArr:A,proposedReturn:[r.leftOuterWhitespace,j,w]}),n=b-1,e[b]===">"&&(n=b),r={},u={};break}}}!e[n].trim()||e[n].charCodeAt(0)===847?(l===null&&(l=n,r.lastOpeningBracketAt!==void 0&&r.lastOpeningBracketAt<n&&r.nameStarts&&r.nameStarts<r.lastOpeningBracketAt&&n===r.lastOpeningBracketAt+1&&!i.some(p=>p.name===r.name)&&(r.onlyPlausible=!0,r.name=void 0,r.nameStarts=void 0)),(e[n]===`
|
|
54
|
+
`||e[n]==="\r")&&(m=n,$&&($=!1))):(l!==null&&(!r.quotes&&u.equalsAt>l-1&&u.nameEnds&&u.equalsAt>u.nameEnds&&e[n]!=='"'&&e[n]!=="'"&&(F(u)&&r.attributes.push(u),u={},r.equalsSpottedAt=void 0),l=null),$||($=!0,W&&!V&&typeof m=="number"&&n&&m<n-1&&(e.slice(m+1,n).trim()?m=null:g.ignoreIndentations||A.push([m+1,n])))),e[n]===" "?y===null&&(y=n):y!==null&&(y=null),r.name==="script"&&(V=!r.slashPresent)}if(e&&!g.ignoreIndentations&&(g.trimOnlySpaces&&e[0]===" "||!g.trimOnlySpaces&&!e[0].trim()))for(let n=0;n<I;n++)if(g.trimOnlySpaces&&e[n]!==" "||!g.trimOnlySpaces&&e[n].trim()){A.push([0,n]);break}else e[n+1]||A.push([0,n+1]);if(e&&(g.trimOnlySpaces&&e[~-e.length]===" "||!g.trimOnlySpaces&&!e[~-e.length].trim())){for(let n=e.length;n--;)if(g.trimOnlySpaces&&e[n]!==" "||!g.trimOnlySpaces&&e[n].trim()){A.push([n+1,I]);break}}let U=A.current();if(!t?.cb&&U&&(U[0]&&!U[0][0]&&(A.ranges[0]=[A.ranges[0][0],A.ranges[0][1]]),U[U.length-1]&&U[U.length-1][1]===e.length&&A.ranges)){let n=A.ranges[A.ranges.length-1][0];e[n-1]&&(g.trimOnlySpaces&&e[n-1]===" "||!g.trimOnlySpaces&&!e[n-1].trim())&&(n-=1);let p=A.ranges[A.ranges.length-1][2];A.ranges[A.ranges.length-1]=[n,A.ranges[A.ranges.length-1][1]],p?.trim()&&A.ranges[A.ranges.length-1].push(p.trimEnd())}return{log:{timeTakenInMilliseconds:Date.now()-a},result:vr(e,A.current()),ranges:A.current(),allTagLocations:o,filteredTagLocations:c}}s(_r,"ae");R(_r,"fe");export{at as defaults,_r as stripHtml,ho as version};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var t=(e,o)=>i(e,"name",{value:o,configurable:!0});import{g as s}from"./_commonjsHelpers-CV2jkJYL.js";var r,a;function m(){return a||(a=1,r=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),r}t(m,"requireHtmlTagsVoid");var l=m();const g=s(l);export{g as default};
|
package/package.json
CHANGED
|
@@ -1,10 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/html",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
|
+
"description": "Functions for HTML, such as escaping or unescaping HTML entities",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
"visulima",
|
|
7
|
+
"html",
|
|
8
|
+
"escape",
|
|
9
|
+
"escaping",
|
|
10
|
+
"escape-html",
|
|
11
|
+
"escape-css",
|
|
12
|
+
"escape-js",
|
|
13
|
+
"sanitize",
|
|
14
|
+
"sanitization",
|
|
15
|
+
"sanitize-html",
|
|
16
|
+
"strip",
|
|
17
|
+
"strip-html",
|
|
18
|
+
"xss",
|
|
19
|
+
"security",
|
|
20
|
+
"entities",
|
|
21
|
+
"html-entities",
|
|
22
|
+
"css",
|
|
23
|
+
"javascript",
|
|
24
|
+
"js",
|
|
25
|
+
"template",
|
|
26
|
+
"template-tag",
|
|
27
|
+
"validation",
|
|
28
|
+
"custom-element",
|
|
29
|
+
"typescript"
|
|
30
|
+
],
|
|
31
|
+
"homepage": "https://visulima.com/packages/html",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/visulima/visulima/issues"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/visulima/visulima.git",
|
|
38
|
+
"directory": "packages/html"
|
|
39
|
+
},
|
|
40
|
+
"funding": [
|
|
41
|
+
{
|
|
42
|
+
"type": "github",
|
|
43
|
+
"url": "https://github.com/sponsors/prisis"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "consulting",
|
|
47
|
+
"url": "https://anolilab.com/support"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"author": {
|
|
52
|
+
"name": "Daniel Bannert",
|
|
53
|
+
"email": "d.bannert@anolilab.de"
|
|
54
|
+
},
|
|
55
|
+
"sideEffects": false,
|
|
56
|
+
"type": "module",
|
|
57
|
+
"exports": {
|
|
58
|
+
".": {
|
|
59
|
+
"types": "./dist/index.d.ts",
|
|
60
|
+
"default": "./dist/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./package.json": "./package.json"
|
|
63
|
+
},
|
|
64
|
+
"files": [
|
|
65
|
+
"dist",
|
|
66
|
+
"README.md",
|
|
67
|
+
"CHANGELOG.md"
|
|
68
|
+
],
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"csstype": "3.2.3",
|
|
71
|
+
"sanitize-html": "2.17.0"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=22.13 <=25.*"
|
|
75
|
+
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public",
|
|
78
|
+
"provenance": true
|
|
79
|
+
}
|
|
80
|
+
}
|