string-left-right 6.0.2 → 6.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,10 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [6.0.2](https://github.com/codsen/codsen/compare/string-left-right@6.0.1...string-left-right@6.0.2) (2022-12-06)
7
-
8
- **Note:** Version bump only for package string-left-right
9
-
10
6
  ## 6.0.0 (2022-12-01)
11
7
 
12
8
  ### BREAKING CHANGES
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * @name string-left-right
3
3
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
4
- * @version 6.0.2
4
+ * @version 6.0.4
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-left-right/}
8
8
  */
9
9
 
10
- import p from"lodash.isplainobject";import a from"lodash.clonedeep";var S="6.0.2";var C=S,c="\xA0";function I(n){let e={value:n,hungry:!1,optional:!1};return(e.value.endsWith("?*")||e.value.endsWith("*?"))&&e.value.length>2?(e.value=e.value.slice(0,e.value.length-2),e.optional=!0,e.hungry=!0):e.value.endsWith("?")&&e.value.length>1?(e.value=e.value.slice(0,~-e.value.length),e.optional=!0):e.value.endsWith("*")&&e.value.length>1&&(e.value=e.value.slice(0,~-e.value.length),e.hungry=!0),e}function R(n){return typeof n=="number"}function b(n){return typeof n=="string"}function D({str:n,idx:e=0,stopAtNewlines:l=!1,stopAtRawNbsp:u=!1}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),!n[e+1]))return null;if(n[e+1]&&(n[e+1].trim()||l&&`
10
+ import{isPlainObject as p}from"codsen-utils";import $ from"lodash.clonedeep";var S="6.0.4";var C=S,c="\xA0";function I(n){let e={value:n,hungry:!1,optional:!1};return(e.value.endsWith("?*")||e.value.endsWith("*?"))&&e.value.length>2?(e.value=e.value.slice(0,e.value.length-2),e.optional=!0,e.hungry=!0):e.value.endsWith("?")&&e.value.length>1?(e.value=e.value.slice(0,~-e.value.length),e.optional=!0):e.value.endsWith("*")&&e.value.length>1&&(e.value=e.value.slice(0,~-e.value.length),e.hungry=!0),e}function R(n){return typeof n=="number"}function b(n){return typeof n=="string"}function D({str:n,idx:e=0,stopAtNewlines:l=!1,stopAtRawNbsp:u=!1}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),!n[e+1]))return null;if(n[e+1]&&(n[e+1].trim()||l&&`
11
11
  \r`.includes(n[e+1])||u&&n[e+1]===c))return e+1;if(n[e+2]&&(n[e+2].trim()||l&&`
12
12
  \r`.includes(n[e+2])||u&&n[e+2]===c))return e+2;for(let t=e+1,m=n.length;t<m;t++)if(n[t].trim()||l&&`
13
13
  \r`.includes(n[t])||u&&n[t]===c)return t;return null}function E(n,e=0){return D({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function j(n,e){return D({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function k(n,e){return D({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function V({str:n,idx:e,stopAtNewlines:l,stopAtRawNbsp:u}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(n[~-e]&&(n[~-e].trim()||l&&`
14
14
  \r`.includes(n[~-e])||u&&n[~-e]===c))return~-e;if(n[e-2]&&(n[e-2].trim()||l&&`
15
15
  \r`.includes(n[e-2])||u&&n[e-2]===c))return e-2;for(let t=e;t--;)if(n[t]&&(n[t].trim()||l&&`
16
- \r`.includes(n[t])||u&&n[t]===c))return t;return null}function y(n,e=0){return V({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function M(n,e){return V({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function W(n,e){return V({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function O(n,e,l,u,t){if(typeof e!="string"||!e.length||(typeof l!="number"&&(l=0),n==="right"&&!e[l+1]||n==="left"&&!e[~-l]))return null;let m=l,o=[],f,i,s,r=0;for(;r<t.length;){if(!b(t[r])||!t[r].length){r+=1;continue}let{value:$,optional:w,hungry:T}=I(t[r]),g=n==="right"?E(e,m):y(e,m);if(u.i&&e[g].toLowerCase()===$.toLowerCase()||!u.i&&e[g]===$){let N=n==="right"?E(e,g):y(e,g);T&&(u.i&&e[N].toLowerCase()===$.toLowerCase()||!u.i&&e[N]===$)?s=!0:r+=1,typeof g=="number"&&n==="right"&&g>m+1?o.push([m+1,g]):n==="left"&&typeof g=="number"&&g<~-m&&o.unshift([g+1,m]),m=g,n==="right"?(f===void 0&&(f=g),i=g):(i===void 0&&(i=g),f=g)}else if(w){r+=1;continue}else if(s){r+=1,s=void 0;continue}else return null}return f===void 0||i===void 0?null:{gaps:o,leftmostChar:f,rightmostChar:i}}var d={i:!1};function J(n,e,...l){if(!l?.length)throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let u;return p(l[0])?u={...d,...l.shift()}:u=d,O("left",n,e,u,Array.from(l).reverse())}function L(n,e,...l){if(!l?.length)throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let u;return p(l[0])?u={...d,...l.shift()}:u=d,O("right",n,e,u,l)}function h(n,e,l,u,t=[]){if(typeof e!="string"||!e.length||((!l||typeof l!="number")&&(l=0),n==="right"&&!e[l+1]||n==="left"&&+l==0))return null;let m=null,o=null;do m=n==="right"?L(e,typeof o=="number"?o:l,...t):J(e,typeof o=="number"?o:l,...t),m!==null&&(o=n==="right"?m.rightmostChar:m.leftmostChar);while(m);if(o!=null&&n==="right"&&(o+=1),o===null)return null;if(n==="right"){if(e[o]?.trim())return o;let i=E(e,o);if(!u||u.mode===0){if(i===o+1)return o;if(e.slice(o,i||e.length).trim()||e.slice(o,i||e.length).includes(`
16
+ \r`.includes(n[t])||u&&n[t]===c))return t;return null}function y(n,e=0){return V({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function M(n,e){return V({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function W(n,e){return V({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function O(n,e,l,u,t){if(typeof e!="string"||!e.length||(typeof l!="number"&&(l=0),n==="right"&&!e[l+1]||n==="left"&&!e[~-l]))return null;let m=l,o=[],f,i,s,r=0;for(;r<t.length;){if(!b(t[r])||!t[r].length){r+=1;continue}let{value:a,optional:w,hungry:T}=I(t[r]),g=n==="right"?E(e,m):y(e,m);if(u.i&&e[g].toLowerCase()===a.toLowerCase()||!u.i&&e[g]===a){let N=n==="right"?E(e,g):y(e,g);T&&(u.i&&e[N].toLowerCase()===a.toLowerCase()||!u.i&&e[N]===a)?s=!0:r+=1,typeof g=="number"&&n==="right"&&g>m+1?o.push([m+1,g]):n==="left"&&typeof g=="number"&&g<~-m&&o.unshift([g+1,m]),m=g,n==="right"?(f===void 0&&(f=g),i=g):(i===void 0&&(i=g),f=g)}else if(w){r+=1;continue}else if(s){r+=1,s=void 0;continue}else return null}return f===void 0||i===void 0?null:{gaps:o,leftmostChar:f,rightmostChar:i}}var d={i:!1};function J(n,e,...l){if(!l?.length)throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let u;return p(l[0])?u={...d,...l.shift()}:u=d,O("left",n,e,u,Array.from(l).reverse())}function L(n,e,...l){if(!l?.length)throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let u;return p(l[0])?u={...d,...l.shift()}:u=d,O("right",n,e,u,l)}function h(n,e,l,u,t=[]){if(typeof e!="string"||!e.length||((!l||typeof l!="number")&&(l=0),n==="right"&&!e[l+1]||n==="left"&&+l==0))return null;let m=null,o=null;do m=n==="right"?L(e,typeof o=="number"?o:l,...t):J(e,typeof o=="number"?o:l,...t),m!==null&&(o=n==="right"?m.rightmostChar:m.leftmostChar);while(m);if(o!=null&&n==="right"&&(o+=1),o===null)return null;if(n==="right"){if(e[o]?.trim())return o;let i=E(e,o);if(!u||u.mode===0){if(i===o+1)return o;if(e.slice(o,i||e.length).trim()||e.slice(o,i||e.length).includes(`
17
17
  `)||e.slice(o,i||e.length).includes("\r")){for(let s=o,r=e.length;s<r;s++)if(`
18
18
  \r`.includes(e[s]))return s}else return i?~-i:e.length}else{if(u.mode===1)return o;if(u.mode===2){let s=e.slice(o);if(s.trim()||s.includes(`
19
- `)||s.includes("\r")){for(let r=o,$=e.length;r<$;r++)if(e[r].trim()||`
19
+ `)||s.includes("\r")){for(let r=o,a=e.length;r<a;r++)if(e[r].trim()||`
20
20
  \r`.includes(e[r]))return r}return e.length}}return i||e.length}if(e[o]&&e[~-o]&&e[~-o].trim())return o;let f=y(e,o);if(!u||u.mode===0){if(f===o-2)return o;if(e.slice(0,o).trim()||e.slice(0,o).includes(`
21
21
  `)||e.slice(0,o).includes("\r")){for(let i=o;i--;)if(`
22
22
  \r`.includes(e[i])||e[i].trim())return i+1+(e[i].trim()?1:0)}return 0}if(u.mode===1)return o;if(u.mode===2){let i=e.slice(0,o);if(i.trim()||i.includes(`
23
23
  `)||i.includes("\r")){for(let s=o;s--;)if(e[s].trim()||`
24
- \r`.includes(e[s]))return s+1}return 0}return f!==null?f+1:0}function _(n,e,...l){if(!l.length||l.length===1&&p(l[0]))return null;let u={mode:0};if(p(l[0])){let t={...u,...a(l[0])};if(!t.mode)t.mode=0;else if(b(t.mode)&&"0123".includes(t.mode))t.mode=Number.parseInt(t.mode,10);else if(!R(t.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 ${t.mode} (type ${typeof t.mode})`);return h("left",n,e,t,a(l).slice(1))}return b(l[0])?h("left",n,e,u,a(l)):h("left",n,e,u,a(l).slice(1))}function H(n,e,...l){if(!l.length||l.length===1&&p(l[0]))return null;let u={mode:0};if(p(l[0])){let t={...u,...a(l[0])};if(!t.mode)t.mode=0;else if(b(t.mode)&&"0123".includes(t.mode))t.mode=Number.parseInt(t.mode,10);else if(!R(t.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 ${t.mode} (type ${typeof t.mode})`);return h("right",n,e,t,a(l).slice(1))}return b(l[0])?h("right",n,e,u,a(l)):h("right",n,e,u,a(l).slice(1))}export{_ as chompLeft,H as chompRight,y as left,J as leftSeq,M as leftStopAtNewLines,W as leftStopAtRawNbsp,E as right,L as rightSeq,j as rightStopAtNewLines,k as rightStopAtRawNbsp,C as version};
24
+ \r`.includes(e[s]))return s+1}return 0}return f!==null?f+1:0}function _(n,e,...l){if(!l.length||l.length===1&&p(l[0]))return null;let u={mode:0};if(p(l[0])){let t={...u,...$(l[0])};if(!t.mode)t.mode=0;else if(b(t.mode)&&"0123".includes(t.mode))t.mode=Number.parseInt(t.mode,10);else if(!R(t.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 ${t.mode} (type ${typeof t.mode})`);return h("left",n,e,t,$(l).slice(1))}return b(l[0])?h("left",n,e,u,$(l)):h("left",n,e,u,$(l).slice(1))}function H(n,e,...l){if(!l.length||l.length===1&&p(l[0]))return null;let u={mode:0};if(p(l[0])){let t={...u,...$(l[0])};if(!t.mode)t.mode=0;else if(b(t.mode)&&"0123".includes(t.mode))t.mode=Number.parseInt(t.mode,10);else if(!R(t.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 ${t.mode} (type ${typeof t.mode})`);return h("right",n,e,t,$(l).slice(1))}return b(l[0])?h("right",n,e,u,$(l)):h("right",n,e,u,$(l).slice(1))}export{_ as chompLeft,H as chompRight,y as left,J as leftSeq,M as leftStopAtNewLines,W as leftStopAtRawNbsp,E as right,L as rightSeq,j as rightStopAtNewLines,k as rightStopAtRawNbsp,C as version};
@@ -1,24 +1,32 @@
1
1
  /**
2
2
  * @name string-left-right
3
3
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
4
- * @version 6.0.2
4
+ * @version 6.0.4
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-left-right/}
8
8
  */
9
9
 
10
- "use strict";var stringLeftRight=(()=>{var ht=Object.create;var A=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,bt=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;var fe=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))ge.call(t,n)&&fe(e,n,t[n]);if(ce)for(var n of ce(t))dt.call(t,n)&&fe(e,n,t[n]);return e};var he=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$t=(e,t)=>{for(var n in t)A(e,n,{get:t[n],enumerable:!0})},pe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of mt(t))!ge.call(e,o)&&o!==n&&A(e,o,{get:()=>t[o],enumerable:!(r=pt(t,o))||r.enumerable});return e};var me=(e,t,n)=>(n=e!=null?ht(bt(e)):{},pe(t||!e||!e.__esModule?A(n,"default",{value:e,enumerable:!0}):n,e)),yt=e=>pe(A({},"__esModule",{value:!0}),e);var ye=he((mr,$e)=>{var Et="[object Object]";function St(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function Ot(e,t){return function(n){return e(t(n))}}var _t=Function.prototype,be=Object.prototype,de=_t.toString,wt=be.hasOwnProperty,Tt=de.call(Object),Dt=be.toString,vt=Ot(Object.getPrototypeOf,Object);function Vt(e){return!!e&&typeof e=="object"}function Nt(e){if(!Vt(e)||Dt.call(e)!=Et||St(e))return!1;var t=vt(e);if(t===null)return!0;var n=wt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&de.call(n)==Tt}$e.exports=Nt});var ut=he((j,w)=>{var Rt=200,Ae="__lodash_hash_undefined__",je=9007199254740991,ee="[object Arguments]",At="[object Array]",Ce="[object Boolean]",Ie="[object Date]",jt="[object Error]",te="[object Function]",Le="[object GeneratorFunction]",F="[object Map]",Fe="[object Number]",ne="[object Object]",Ee="[object Promise]",Ue="[object RegExp]",U="[object Set]",Je="[object String]",xe="[object Symbol]",k="[object WeakMap]",Pe="[object ArrayBuffer]",J="[object DataView]",Me="[object Float32Array]",qe="[object Float64Array]",He="[object Int8Array]",Be="[object Int16Array]",Ge="[object Int32Array]",We="[object Uint8Array]",Ke="[object Uint8ClampedArray]",ke="[object Uint16Array]",Ye="[object Uint32Array]",Ct=/[\\^$.*+?()[\]{}|]/g,It=/\w*$/,Lt=/^\[object .+?Constructor\]$/,Ft=/^(?:0|[1-9]\d*)$/,s={};s[ee]=s[At]=s[Pe]=s[J]=s[Ce]=s[Ie]=s[Me]=s[qe]=s[He]=s[Be]=s[Ge]=s[F]=s[Fe]=s[ne]=s[Ue]=s[U]=s[Je]=s[xe]=s[We]=s[Ke]=s[ke]=s[Ye]=!0;s[jt]=s[te]=s[k]=!1;var Ut=typeof global=="object"&&global&&global.Object===Object&&global,Jt=typeof self=="object"&&self&&self.Object===Object&&self,m=Ut||Jt||Function("return this")(),Xe=typeof j=="object"&&j&&!j.nodeType&&j,Se=Xe&&typeof w=="object"&&w&&!w.nodeType&&w,xt=Se&&Se.exports===Xe;function Pt(e,t){return e.set(t[0],t[1]),e}function Mt(e,t){return e.add(t),e}function qt(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function Ht(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function Ze(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Bt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Gt(e,t){return e==null?void 0:e[t]}function Qe(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function Oe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}function re(e,t){return function(n){return e(t(n))}}function _e(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Wt=Array.prototype,Kt=Function.prototype,x=Object.prototype,K=m["__core-js_shared__"],we=function(){var e=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ze=Kt.toString,$=x.hasOwnProperty,P=x.toString,kt=RegExp("^"+ze.call($).replace(Ct,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Te=xt?m.Buffer:void 0,De=m.Symbol,ve=m.Uint8Array,Yt=re(Object.getPrototypeOf,Object),Xt=Object.create,Zt=x.propertyIsEnumerable,Qt=Wt.splice,Ve=Object.getOwnPropertySymbols,zt=Te?Te.isBuffer:void 0,en=re(Object.keys,Object),Y=v(m,"DataView"),C=v(m,"Map"),X=v(m,"Promise"),Z=v(m,"Set"),Q=v(m,"WeakMap"),I=v(Object,"create"),tn=S(Y),nn=S(C),rn=S(X),on=S(Z),ln=S(Q),Ne=De?De.prototype:void 0,Re=Ne?Ne.valueOf:void 0;function E(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function un(){this.__data__=I?I(null):{}}function sn(e){return this.has(e)&&delete this.__data__[e]}function an(e){var t=this.__data__;if(I){var n=t[e];return n===Ae?void 0:n}return $.call(t,e)?t[e]:void 0}function cn(e){var t=this.__data__;return I?t[e]!==void 0:$.call(t,e)}function fn(e,t){var n=this.__data__;return n[e]=I&&t===void 0?Ae:t,this}E.prototype.clear=un;E.prototype.delete=sn;E.prototype.get=an;E.prototype.has=cn;E.prototype.set=fn;function b(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function gn(){this.__data__=[]}function hn(e){var t=this.__data__,n=M(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Qt.call(t,n,1),!0}function pn(e){var t=this.__data__,n=M(t,e);return n<0?void 0:t[n][1]}function mn(e){return M(this.__data__,e)>-1}function bn(e,t){var n=this.__data__,r=M(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}b.prototype.clear=gn;b.prototype.delete=hn;b.prototype.get=pn;b.prototype.has=mn;b.prototype.set=bn;function T(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function dn(){this.__data__={hash:new E,map:new(C||b),string:new E}}function $n(e){return q(this,e).delete(e)}function yn(e){return q(this,e).get(e)}function En(e){return q(this,e).has(e)}function Sn(e,t){return q(this,e).set(e,t),this}T.prototype.clear=dn;T.prototype.delete=$n;T.prototype.get=yn;T.prototype.has=En;T.prototype.set=Sn;function D(e){this.__data__=new b(e)}function On(){this.__data__=new b}function _n(e){return this.__data__.delete(e)}function wn(e){return this.__data__.get(e)}function Tn(e){return this.__data__.has(e)}function Dn(e,t){var n=this.__data__;if(n instanceof b){var r=n.__data__;if(!C||r.length<Rt-1)return r.push([e,t]),this;n=this.__data__=new T(r)}return n.set(e,t),this}D.prototype.clear=On;D.prototype.delete=_n;D.prototype.get=wn;D.prototype.has=Tn;D.prototype.set=Dn;function vn(e,t){var n=le(e)||Zn(e)?Bt(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||$.call(e,i))&&!(o&&(i=="length"||Kn(i,r)))&&n.push(i);return n}function et(e,t,n){var r=e[t];(!($.call(e,t)&&ot(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function M(e,t){for(var n=e.length;n--;)if(ot(e[n][0],t))return n;return-1}function Vn(e,t){return e&&tt(t,ie(t),e)}function z(e,t,n,r,o,i,l){var c;if(r&&(c=i?r(e,o,i,l):r(e)),c!==void 0)return c;if(!H(e))return e;var h=le(e);if(h){if(c=Bn(e),!t)return Mn(e,c)}else{var u=y(e),a=u==te||u==Le;if(zn(e))return In(e,t);if(u==ne||u==ee||a&&!i){if(Qe(e))return i?e:{};if(c=Gn(a?{}:e),!t)return qn(e,Vn(c,e))}else{if(!s[u])return i?e:{};c=Wn(e,u,z,t)}}l||(l=new D);var g=l.get(e);if(g)return g;if(l.set(e,c),!h)var _=n?Hn(e):ie(e);return qt(_||e,function(R,f){_&&(f=R,R=e[f]),et(c,f,z(R,t,n,r,f,e,l))}),c}function Nn(e){return H(e)?Xt(e):{}}function Rn(e,t,n){var r=t(e);return le(e)?r:Ht(r,n(e))}function An(e){return P.call(e)}function jn(e){if(!H(e)||Yn(e))return!1;var t=it(e)||Qe(e)?kt:Lt;return t.test(S(e))}function Cn(e){if(!rt(e))return en(e);var t=[];for(var n in Object(e))$.call(e,n)&&n!="constructor"&&t.push(n);return t}function In(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function oe(e){var t=new e.constructor(e.byteLength);return new ve(t).set(new ve(e)),t}function Ln(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Fn(e,t,n){var r=t?n(Oe(e),!0):Oe(e);return Ze(r,Pt,new e.constructor)}function Un(e){var t=new e.constructor(e.source,It.exec(e));return t.lastIndex=e.lastIndex,t}function Jn(e,t,n){var r=t?n(_e(e),!0):_e(e);return Ze(r,Mt,new e.constructor)}function xn(e){return Re?Object(Re.call(e)):{}}function Pn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Mn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function tt(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],c=r?r(n[l],e[l],l,n,e):void 0;et(n,l,c===void 0?e[l]:c)}return n}function qn(e,t){return tt(e,nt(e),t)}function Hn(e){return Rn(e,ie,nt)}function q(e,t){var n=e.__data__;return kn(t)?n[typeof t=="string"?"string":"hash"]:n.map}function v(e,t){var n=Gt(e,t);return jn(n)?n:void 0}var nt=Ve?re(Ve,Object):nr,y=An;(Y&&y(new Y(new ArrayBuffer(1)))!=J||C&&y(new C)!=F||X&&y(X.resolve())!=Ee||Z&&y(new Z)!=U||Q&&y(new Q)!=k)&&(y=function(e){var t=P.call(e),n=t==ne?e.constructor:void 0,r=n?S(n):void 0;if(r)switch(r){case tn:return J;case nn:return F;case rn:return Ee;case on:return U;case ln:return k}return t});function Bn(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]=="string"&&$.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Gn(e){return typeof e.constructor=="function"&&!rt(e)?Nn(Yt(e)):{}}function Wn(e,t,n,r){var o=e.constructor;switch(t){case Pe:return oe(e);case Ce:case Ie:return new o(+e);case J:return Ln(e,r);case Me:case qe:case He:case Be:case Ge:case We:case Ke:case ke:case Ye:return Pn(e,r);case F:return Fn(e,r,n);case Fe:case Je:return new o(e);case Ue:return Un(e);case U:return Jn(e,r,n);case xe:return xn(e)}}function Kn(e,t){return t=t==null?je:t,!!t&&(typeof e=="number"||Ft.test(e))&&e>-1&&e%1==0&&e<t}function kn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yn(e){return!!we&&we in e}function rt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||x;return e===n}function S(e){if(e!=null){try{return ze.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Xn(e){return z(e,!0,!0)}function ot(e,t){return e===t||e!==e&&t!==t}function Zn(e){return Qn(e)&&$.call(e,"callee")&&(!Zt.call(e,"callee")||P.call(e)==ee)}var le=Array.isArray;function lt(e){return e!=null&&er(e.length)&&!it(e)}function Qn(e){return tr(e)&&lt(e)}var zn=zt||rr;function it(e){var t=H(e)?P.call(e):"";return t==te||t==Le}function er(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=je}function H(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function tr(e){return!!e&&typeof e=="object"}function ie(e){return lt(e)?vn(e):Cn(e)}function nr(){return[]}function rr(){return!1}w.exports=Xn});var hr={};$t(hr,{chompLeft:()=>fr,chompRight:()=>gr,left:()=>G,leftSeq:()=>ft,leftStopAtNewLines:()=>ar,leftStopAtRawNbsp:()=>cr,right:()=>B,rightSeq:()=>gt,rightStopAtNewLines:()=>ur,rightStopAtRawNbsp:()=>sr,version:()=>lr});var O=me(ye(),1),d=me(ut(),1);var st="6.0.2";var lr=st,V="\xA0";function ir(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}function at(e){return typeof e=="number"}function L(e){return typeof e=="string"}function ue({str:e,idx:t=0,stopAtNewlines:n=!1,stopAtRawNbsp:r=!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()||n&&`
11
- \r`.includes(e[t+1])||r&&e[t+1]===V))return t+1;if(e[t+2]&&(e[t+2].trim()||n&&`
12
- \r`.includes(e[t+2])||r&&e[t+2]===V))return t+2;for(let o=t+1,i=e.length;o<i;o++)if(e[o].trim()||n&&`
13
- \r`.includes(e[o])||r&&e[o]===V)return o;return null}function B(e,t=0){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function ur(e,t){return ue({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function sr(e,t){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function se({str:e,idx:t,stopAtNewlines:n,stopAtRawNbsp:r}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||n&&`
14
- \r`.includes(e[~-t])||r&&e[~-t]===V))return~-t;if(e[t-2]&&(e[t-2].trim()||n&&`
15
- \r`.includes(e[t-2])||r&&e[t-2]===V))return t-2;for(let o=t;o--;)if(e[o]&&(e[o].trim()||n&&`
16
- \r`.includes(e[o])||r&&e[o]===V))return o;return null}function G(e,t=0){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function ar(e,t){return se({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function cr(e,t){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function ct(e,t,n,r,o){if(typeof t!="string"||!t.length||(typeof n!="number"&&(n=0),e==="right"&&!t[n+1]||e==="left"&&!t[~-n]))return null;let i=n,l=[],c,h,u,a=0;for(;a<o.length;){if(!L(o[a])||!o[a].length){a+=1;continue}let{value:g,optional:_,hungry:R}=ir(o[a]),f=e==="right"?B(t,i):G(t,i);if(r.i&&t[f].toLowerCase()===g.toLowerCase()||!r.i&&t[f]===g){let ae=e==="right"?B(t,f):G(t,f);R&&(r.i&&t[ae].toLowerCase()===g.toLowerCase()||!r.i&&t[ae]===g)?u=!0:a+=1,typeof f=="number"&&e==="right"&&f>i+1?l.push([i+1,f]):e==="left"&&typeof f=="number"&&f<~-i&&l.unshift([f+1,i]),i=f,e==="right"?(c===void 0&&(c=f),h=f):(h===void 0&&(h=f),c=f)}else if(_){a+=1;continue}else if(u){a+=1,u=void 0;continue}else return null}return c===void 0||h===void 0?null:{gaps:l,leftmostChar:c,rightmostChar:h}}var W={i:!1};function ft(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let r;return(0,O.default)(n[0])?r=p(p({},W),n.shift()):r=W,ct("left",e,t,r,Array.from(n).reverse())}function gt(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let r;return(0,O.default)(n[0])?r=p(p({},W),n.shift()):r=W,ct("right",e,t,r,n)}function N(e,t,n,r,o=[]){var h;if(typeof t!="string"||!t.length||((!n||typeof n!="number")&&(n=0),e==="right"&&!t[n+1]||e==="left"&&+n==0))return null;let i=null,l=null;do i=e==="right"?gt(t,typeof l=="number"?l:n,...o):ft(t,typeof l=="number"?l:n,...o),i!==null&&(l=e==="right"?i.rightmostChar:i.leftmostChar);while(i);if(l!=null&&e==="right"&&(l+=1),l===null)return null;if(e==="right"){if((h=t[l])!=null&&h.trim())return l;let u=B(t,l);if(!r||r.mode===0){if(u===l+1)return l;if(t.slice(l,u||t.length).trim()||t.slice(l,u||t.length).includes(`
10
+ "use strict";var stringLeftRight=(()=>{var ut=Object.create;var A=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,ct=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var fe=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))ge.call(t,n)&&fe(e,n,t[n]);if(ce)for(var n of ce(t))ft.call(t,n)&&fe(e,n,t[n]);return e};var gt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ht=(e,t)=>{for(var n in t)A(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of at(t))!ge.call(e,o)&&o!==n&&A(e,o,{get:()=>t[o],enumerable:!(r=st(t,o))||r.enumerable});return e};var pt=(e,t,n)=>(n=e!=null?ut(ct(e)):{},he(t||!e||!e.__esModule?A(n,"default",{value:e,enumerable:!0}):n,e)),mt=e=>he(A({},"__esModule",{value:!0}),e);var tt=gt((C,O)=>{var bt=200,De="__lodash_hash_undefined__",Te=9007199254740991,ee="[object Arguments]",dt="[object Array]",ve="[object Boolean]",Ne="[object Date]",$t="[object Error]",te="[object Function]",Ve="[object GeneratorFunction]",U="[object Map]",Re="[object Number]",ne="[object Object]",pe="[object Promise]",Ae="[object RegExp]",F="[object Set]",Ce="[object String]",Ie="[object Symbol]",K="[object WeakMap]",je="[object ArrayBuffer]",x="[object DataView]",Le="[object Float32Array]",Ue="[object Float64Array]",Fe="[object Int8Array]",xe="[object Int16Array]",Je="[object Int32Array]",Me="[object Uint8Array]",Pe="[object Uint8ClampedArray]",qe="[object Uint16Array]",He="[object Uint32Array]",yt=/[\\^$.*+?()[\]{}|]/g,Et=/\w*$/,wt=/^\[object .+?Constructor\]$/,St=/^(?:0|[1-9]\d*)$/,s={};s[ee]=s[dt]=s[je]=s[x]=s[ve]=s[Ne]=s[Le]=s[Ue]=s[Fe]=s[xe]=s[Je]=s[U]=s[Re]=s[ne]=s[Ae]=s[F]=s[Ce]=s[Ie]=s[Me]=s[Pe]=s[qe]=s[He]=!0;s[$t]=s[te]=s[K]=!1;var _t=typeof global=="object"&&global&&global.Object===Object&&global,Ot=typeof self=="object"&&self&&self.Object===Object&&self,m=_t||Ot||Function("return this")(),We=typeof C=="object"&&C&&!C.nodeType&&C,me=We&&typeof O=="object"&&O&&!O.nodeType&&O,Dt=me&&me.exports===We;function Tt(e,t){return e.set(t[0],t[1]),e}function vt(e,t){return e.add(t),e}function Nt(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function Vt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function ke(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Rt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function At(e,t){return e==null?void 0:e[t]}function Be(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function be(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}function re(e,t){return function(n){return e(t(n))}}function de(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ct=Array.prototype,It=Function.prototype,J=Object.prototype,G=m["__core-js_shared__"],$e=function(){var e=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ge=It.toString,$=J.hasOwnProperty,M=J.toString,jt=RegExp("^"+Ge.call($).replace(yt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=Dt?m.Buffer:void 0,Ee=m.Symbol,we=m.Uint8Array,Lt=re(Object.getPrototypeOf,Object),Ut=Object.create,Ft=J.propertyIsEnumerable,xt=Ct.splice,Se=Object.getOwnPropertySymbols,Jt=ye?ye.isBuffer:void 0,Mt=re(Object.keys,Object),Q=v(m,"DataView"),I=v(m,"Map"),Y=v(m,"Promise"),X=v(m,"Set"),Z=v(m,"WeakMap"),j=v(Object,"create"),Pt=S(Q),qt=S(I),Ht=S(Y),Wt=S(X),kt=S(Z),_e=Ee?Ee.prototype:void 0,Oe=_e?_e.valueOf:void 0;function w(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Bt(){this.__data__=j?j(null):{}}function Gt(e){return this.has(e)&&delete this.__data__[e]}function Kt(e){var t=this.__data__;if(j){var n=t[e];return n===De?void 0:n}return $.call(t,e)?t[e]:void 0}function Qt(e){var t=this.__data__;return j?t[e]!==void 0:$.call(t,e)}function Yt(e,t){var n=this.__data__;return n[e]=j&&t===void 0?De:t,this}w.prototype.clear=Bt;w.prototype.delete=Gt;w.prototype.get=Kt;w.prototype.has=Qt;w.prototype.set=Yt;function b(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xt(){this.__data__=[]}function Zt(e){var t=this.__data__,n=P(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():xt.call(t,n,1),!0}function zt(e){var t=this.__data__,n=P(t,e);return n<0?void 0:t[n][1]}function en(e){return P(this.__data__,e)>-1}function tn(e,t){var n=this.__data__,r=P(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}b.prototype.clear=Xt;b.prototype.delete=Zt;b.prototype.get=zt;b.prototype.has=en;b.prototype.set=tn;function D(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function nn(){this.__data__={hash:new w,map:new(I||b),string:new w}}function rn(e){return q(this,e).delete(e)}function on(e){return q(this,e).get(e)}function ln(e){return q(this,e).has(e)}function un(e,t){return q(this,e).set(e,t),this}D.prototype.clear=nn;D.prototype.delete=rn;D.prototype.get=on;D.prototype.has=ln;D.prototype.set=un;function T(e){this.__data__=new b(e)}function sn(){this.__data__=new b}function an(e){return this.__data__.delete(e)}function cn(e){return this.__data__.get(e)}function fn(e){return this.__data__.has(e)}function gn(e,t){var n=this.__data__;if(n instanceof b){var r=n.__data__;if(!I||r.length<bt-1)return r.push([e,t]),this;n=this.__data__=new D(r)}return n.set(e,t),this}T.prototype.clear=sn;T.prototype.delete=an;T.prototype.get=cn;T.prototype.has=fn;T.prototype.set=gn;function hn(e,t){var n=le(e)||Fn(e)?Rt(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||$.call(e,i))&&!(o&&(i=="length"||In(i,r)))&&n.push(i);return n}function Ke(e,t,n){var r=e[t];(!($.call(e,t)&&Ze(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function P(e,t){for(var n=e.length;n--;)if(Ze(e[n][0],t))return n;return-1}function pn(e,t){return e&&Qe(t,ie(t),e)}function z(e,t,n,r,o,i,l){var c;if(r&&(c=i?r(e,o,i,l):r(e)),c!==void 0)return c;if(!H(e))return e;var h=le(e);if(h){if(c=Rn(e),!t)return vn(e,c)}else{var u=E(e),a=u==te||u==Ve;if(Jn(e))return En(e,t);if(u==ne||u==ee||a&&!i){if(Be(e))return i?e:{};if(c=An(a?{}:e),!t)return Nn(e,pn(c,e))}else{if(!s[u])return i?e:{};c=Cn(e,u,z,t)}}l||(l=new T);var g=l.get(e);if(g)return g;if(l.set(e,c),!h)var _=n?Vn(e):ie(e);return Nt(_||e,function(R,f){_&&(f=R,R=e[f]),Ke(c,f,z(R,t,n,r,f,e,l))}),c}function mn(e){return H(e)?Ut(e):{}}function bn(e,t,n){var r=t(e);return le(e)?r:Vt(r,n(e))}function dn(e){return M.call(e)}function $n(e){if(!H(e)||Ln(e))return!1;var t=et(e)||Be(e)?jt:wt;return t.test(S(e))}function yn(e){if(!Xe(e))return Mt(e);var t=[];for(var n in Object(e))$.call(e,n)&&n!="constructor"&&t.push(n);return t}function En(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function oe(e){var t=new e.constructor(e.byteLength);return new we(t).set(new we(e)),t}function wn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Sn(e,t,n){var r=t?n(be(e),!0):be(e);return ke(r,Tt,new e.constructor)}function _n(e){var t=new e.constructor(e.source,Et.exec(e));return t.lastIndex=e.lastIndex,t}function On(e,t,n){var r=t?n(de(e),!0):de(e);return ke(r,vt,new e.constructor)}function Dn(e){return Oe?Object(Oe.call(e)):{}}function Tn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function vn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function Qe(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],c=r?r(n[l],e[l],l,n,e):void 0;Ke(n,l,c===void 0?e[l]:c)}return n}function Nn(e,t){return Qe(e,Ye(e),t)}function Vn(e){return bn(e,ie,Ye)}function q(e,t){var n=e.__data__;return jn(t)?n[typeof t=="string"?"string":"hash"]:n.map}function v(e,t){var n=At(e,t);return $n(n)?n:void 0}var Ye=Se?re(Se,Object):qn,E=dn;(Q&&E(new Q(new ArrayBuffer(1)))!=x||I&&E(new I)!=U||Y&&E(Y.resolve())!=pe||X&&E(new X)!=F||Z&&E(new Z)!=K)&&(E=function(e){var t=M.call(e),n=t==ne?e.constructor:void 0,r=n?S(n):void 0;if(r)switch(r){case Pt:return x;case qt:return U;case Ht:return pe;case Wt:return F;case kt:return K}return t});function Rn(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]=="string"&&$.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function An(e){return typeof e.constructor=="function"&&!Xe(e)?mn(Lt(e)):{}}function Cn(e,t,n,r){var o=e.constructor;switch(t){case je:return oe(e);case ve:case Ne:return new o(+e);case x:return wn(e,r);case Le:case Ue:case Fe:case xe:case Je:case Me:case Pe:case qe:case He:return Tn(e,r);case U:return Sn(e,r,n);case Re:case Ce:return new o(e);case Ae:return _n(e);case F:return On(e,r,n);case Ie:return Dn(e)}}function In(e,t){return t=t==null?Te:t,!!t&&(typeof e=="number"||St.test(e))&&e>-1&&e%1==0&&e<t}function jn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ln(e){return!!$e&&$e in e}function Xe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||J;return e===n}function S(e){if(e!=null){try{return Ge.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Un(e){return z(e,!0,!0)}function Ze(e,t){return e===t||e!==e&&t!==t}function Fn(e){return xn(e)&&$.call(e,"callee")&&(!Ft.call(e,"callee")||M.call(e)==ee)}var le=Array.isArray;function ze(e){return e!=null&&Mn(e.length)&&!et(e)}function xn(e){return Pn(e)&&ze(e)}var Jn=Jt||Hn;function et(e){var t=H(e)?M.call(e):"";return t==te||t==Ve}function Mn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Te}function H(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Pn(e){return!!e&&typeof e=="object"}function ie(e){return ze(e)?hn(e):yn(e)}function qn(){return[]}function Hn(){return!1}O.exports=Un});var zn={};ht(zn,{chompLeft:()=>Xn,chompRight:()=>Zn,left:()=>k,leftSeq:()=>lt,leftStopAtNewLines:()=>Qn,leftStopAtRawNbsp:()=>Yn,right:()=>W,rightSeq:()=>it,rightStopAtNewLines:()=>Gn,rightStopAtRawNbsp:()=>Kn,version:()=>kn});function y(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)}var d=pt(tt(),1);var nt="6.0.4";var kn=nt,N="\xA0";function Bn(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}function rt(e){return typeof e=="number"}function L(e){return typeof e=="string"}function ue({str:e,idx:t=0,stopAtNewlines:n=!1,stopAtRawNbsp:r=!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()||n&&`
11
+ \r`.includes(e[t+1])||r&&e[t+1]===N))return t+1;if(e[t+2]&&(e[t+2].trim()||n&&`
12
+ \r`.includes(e[t+2])||r&&e[t+2]===N))return t+2;for(let o=t+1,i=e.length;o<i;o++)if(e[o].trim()||n&&`
13
+ \r`.includes(e[o])||r&&e[o]===N)return o;return null}function W(e,t=0){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Gn(e,t){return ue({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function Kn(e,t){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function se({str:e,idx:t,stopAtNewlines:n,stopAtRawNbsp:r}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||n&&`
14
+ \r`.includes(e[~-t])||r&&e[~-t]===N))return~-t;if(e[t-2]&&(e[t-2].trim()||n&&`
15
+ \r`.includes(e[t-2])||r&&e[t-2]===N))return t-2;for(let o=t;o--;)if(e[o]&&(e[o].trim()||n&&`
16
+ \r`.includes(e[o])||r&&e[o]===N))return o;return null}function k(e,t=0){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Qn(e,t){return se({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function Yn(e,t){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function ot(e,t,n,r,o){if(typeof t!="string"||!t.length||(typeof n!="number"&&(n=0),e==="right"&&!t[n+1]||e==="left"&&!t[~-n]))return null;let i=n,l=[],c,h,u,a=0;for(;a<o.length;){if(!L(o[a])||!o[a].length){a+=1;continue}let{value:g,optional:_,hungry:R}=Bn(o[a]),f=e==="right"?W(t,i):k(t,i);if(r.i&&t[f].toLowerCase()===g.toLowerCase()||!r.i&&t[f]===g){let ae=e==="right"?W(t,f):k(t,f);R&&(r.i&&t[ae].toLowerCase()===g.toLowerCase()||!r.i&&t[ae]===g)?u=!0:a+=1,typeof f=="number"&&e==="right"&&f>i+1?l.push([i+1,f]):e==="left"&&typeof f=="number"&&f<~-i&&l.unshift([f+1,i]),i=f,e==="right"?(c===void 0&&(c=f),h=f):(h===void 0&&(h=f),c=f)}else if(_){a+=1;continue}else if(u){a+=1,u=void 0;continue}else return null}return c===void 0||h===void 0?null:{gaps:l,leftmostChar:c,rightmostChar:h}}var B={i:!1};function lt(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let r;return y(n[0])?r=p(p({},B),n.shift()):r=B,ot("left",e,t,r,Array.from(n).reverse())}function it(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let r;return y(n[0])?r=p(p({},B),n.shift()):r=B,ot("right",e,t,r,n)}function V(e,t,n,r,o=[]){var h;if(typeof t!="string"||!t.length||((!n||typeof n!="number")&&(n=0),e==="right"&&!t[n+1]||e==="left"&&+n==0))return null;let i=null,l=null;do i=e==="right"?it(t,typeof l=="number"?l:n,...o):lt(t,typeof l=="number"?l:n,...o),i!==null&&(l=e==="right"?i.rightmostChar:i.leftmostChar);while(i);if(l!=null&&e==="right"&&(l+=1),l===null)return null;if(e==="right"){if((h=t[l])!=null&&h.trim())return l;let u=W(t,l);if(!r||r.mode===0){if(u===l+1)return l;if(t.slice(l,u||t.length).trim()||t.slice(l,u||t.length).includes(`
17
17
  `)||t.slice(l,u||t.length).includes("\r")){for(let a=l,g=t.length;a<g;a++)if(`
18
18
  \r`.includes(t[a]))return a}else return u?~-u:t.length}else{if(r.mode===1)return l;if(r.mode===2){let a=t.slice(l);if(a.trim()||a.includes(`
19
19
  `)||a.includes("\r")){for(let g=l,_=t.length;g<_;g++)if(t[g].trim()||`
20
- \r`.includes(t[g]))return g}return t.length}}return u||t.length}if(t[l]&&t[~-l]&&t[~-l].trim())return l;let c=G(t,l);if(!r||r.mode===0){if(c===l-2)return l;if(t.slice(0,l).trim()||t.slice(0,l).includes(`
20
+ \r`.includes(t[g]))return g}return t.length}}return u||t.length}if(t[l]&&t[~-l]&&t[~-l].trim())return l;let c=k(t,l);if(!r||r.mode===0){if(c===l-2)return l;if(t.slice(0,l).trim()||t.slice(0,l).includes(`
21
21
  `)||t.slice(0,l).includes("\r")){for(let u=l;u--;)if(`
22
22
  \r`.includes(t[u])||t[u].trim())return u+1+(t[u].trim()?1:0)}return 0}if(r.mode===1)return l;if(r.mode===2){let u=t.slice(0,l);if(u.trim()||u.includes(`
23
23
  `)||u.includes("\r")){for(let a=l;a--;)if(t[a].trim()||`
24
- \r`.includes(t[a]))return a+1}return 0}return c!==null?c+1:0}function fr(e,t,...n){if(!n.length||n.length===1&&(0,O.default)(n[0]))return null;let r={mode:0};if((0,O.default)(n[0])){let o=p(p({},r),(0,d.default)(n[0]));if(!o.mode)o.mode=0;else if(L(o.mode)&&"0123".includes(o.mode))o.mode=Number.parseInt(o.mode,10);else if(!at(o.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 ${o.mode} (type ${typeof o.mode})`);return N("left",e,t,o,(0,d.default)(n).slice(1))}return L(n[0])?N("left",e,t,r,(0,d.default)(n)):N("left",e,t,r,(0,d.default)(n).slice(1))}function gr(e,t,...n){if(!n.length||n.length===1&&(0,O.default)(n[0]))return null;let r={mode:0};if((0,O.default)(n[0])){let o=p(p({},r),(0,d.default)(n[0]));if(!o.mode)o.mode=0;else if(L(o.mode)&&"0123".includes(o.mode))o.mode=Number.parseInt(o.mode,10);else if(!at(o.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 ${o.mode} (type ${typeof o.mode})`);return N("right",e,t,o,(0,d.default)(n).slice(1))}return L(n[0])?N("right",e,t,r,(0,d.default)(n)):N("right",e,t,r,(0,d.default)(n).slice(1))}return yt(hr);})();
24
+ \r`.includes(t[a]))return a+1}return 0}return c!==null?c+1:0}function Xn(e,t,...n){if(!n.length||n.length===1&&y(n[0]))return null;let r={mode:0};if(y(n[0])){let o=p(p({},r),(0,d.default)(n[0]));if(!o.mode)o.mode=0;else if(L(o.mode)&&"0123".includes(o.mode))o.mode=Number.parseInt(o.mode,10);else if(!rt(o.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 ${o.mode} (type ${typeof o.mode})`);return V("left",e,t,o,(0,d.default)(n).slice(1))}return L(n[0])?V("left",e,t,r,(0,d.default)(n)):V("left",e,t,r,(0,d.default)(n).slice(1))}function Zn(e,t,...n){if(!n.length||n.length===1&&y(n[0]))return null;let r={mode:0};if(y(n[0])){let o=p(p({},r),(0,d.default)(n[0]));if(!o.mode)o.mode=0;else if(L(o.mode)&&"0123".includes(o.mode))o.mode=Number.parseInt(o.mode,10);else if(!rt(o.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 ${o.mode} (type ${typeof o.mode})`);return V("right",e,t,o,(0,d.default)(n).slice(1))}return L(n[0])?V("right",e,t,r,(0,d.default)(n)):V("right",e,t,r,(0,d.default)(n).slice(1))}return mt(zn);})();
25
+ /**
26
+ * @name codsen-utils
27
+ * @fileoverview Various utility functions
28
+ * @version 1.1.0
29
+ * @author Roy Revelt, Codsen Ltd
30
+ * @license MIT
31
+ * {@link https://codsen.com/os/codsen-utils/}
32
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-left-right",
3
- "version": "6.0.2",
3
+ "version": "6.0.4",
4
4
  "description": "Looks up the first non-whitespace character to the left/right of a given index",
5
5
  "keywords": [
6
6
  "check",
@@ -73,11 +73,10 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "lodash.clonedeep": "^4.5.0",
77
- "lodash.isplainobject": "^4.0.6"
76
+ "codsen-utils": "^1.1.0",
77
+ "lodash.clonedeep": "^4.5.0"
78
78
  },
79
79
  "devDependencies": {
80
- "@types/lodash.clonedeep": "^4.5.7",
81
- "@types/lodash.isplainobject": "^4.0.7"
80
+ "@types/lodash.clonedeep": "^4.5.7"
82
81
  }
83
82
  }
package/types/index.d.ts CHANGED
File without changes