string-remove-thousand-separators
Version:
Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
80 lines (77 loc) • 22.3 kB
JavaScript
/**
* @name string-remove-thousand-separators
* @fileoverview Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
* @version 7.0.20
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/string-remove-thousand-separators/}
*/
;var stringRemoveThousandSeparators=(()=>{var je=Object.create;var A=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,Ne=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var E=(e,r,a)=>r in e?A(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,g=(e,r)=>{for(var a in r||(r={}))_.call(r,a)&&E(e,a,r[a]);if(F)for(var a of F(r))ke.call(r,a)&&E(e,a,r[a]);return e};var We=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Fe=(e,r)=>{for(var a in r)A(e,a,{get:r[a],enumerable:!0})},C=(e,r,a,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of De(r))!_.call(e,u)&&u!==a&&A(e,u,{get:()=>r[u],enumerable:!(s=Re(r,u))||s.enumerable});return e};var _e=(e,r,a)=>(a=e!=null?je(Ne(e)):{},C(r||!e||!e.__esModule?A(a,"default",{value:e,enumerable:!0}):a,e)),Ce=e=>C(A({},"__esModule",{value:!0}),e);var j=(e,r,a)=>E(e,typeof r!="symbol"?r+"":r,a);var q=We((lt,L)=>{"use strict";L.exports=He;function T(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function He(e){if(e=e||{},e.circles)return Je(e);let r=new Map;if(r.set(Date,n=>new Date(n)),r.set(Map,(n,i)=>new Map(s(Array.from(n),i))),r.set(Set,(n,i)=>new Set(s(Array.from(n),i))),e.constructorHandlers)for(let n of e.constructorHandlers)r.set(n[0],n[1]);let a=null;return e.proto?t:u;function s(n,i){let l=Object.keys(n),o=new Array(l.length);for(let f=0;f<l.length;f++){let p=l[f],d=n[p];typeof d!="object"||d===null?o[p]=d:d.constructor!==Object&&(a=r.get(d.constructor))?o[p]=a(d,i):ArrayBuffer.isView(d)?o[p]=T(d):o[p]=i(d)}return o}function u(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return s(n,u);if(n.constructor!==Object&&(a=r.get(n.constructor)))return a(n,u);let i={};for(let l in n){if(Object.hasOwnProperty.call(n,l)===!1)continue;let o=n[l];typeof o!="object"||o===null?i[l]=o:o.constructor!==Object&&(a=r.get(o.constructor))?i[l]=a(o,u):ArrayBuffer.isView(o)?i[l]=T(o):i[l]=u(o)}return i}function t(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return s(n,t);if(n.constructor!==Object&&(a=r.get(n.constructor)))return a(n,t);let i={};for(let l in n){let o=n[l];typeof o!="object"||o===null?i[l]=o:o.constructor!==Object&&(a=r.get(o.constructor))?i[l]=a(o,t):ArrayBuffer.isView(o)?i[l]=T(o):i[l]=t(o)}return i}}function Je(e){let r=[],a=[],s=new Map;if(s.set(Date,l=>new Date(l)),s.set(Map,(l,o)=>new Map(t(Array.from(l),o))),s.set(Set,(l,o)=>new Set(t(Array.from(l),o))),e.constructorHandlers)for(let l of e.constructorHandlers)s.set(l[0],l[1]);let u=null;return e.proto?i:n;function t(l,o){let f=Object.keys(l),p=new Array(f.length);for(let d=0;d<f.length;d++){let m=f[d],c=l[m];if(typeof c!="object"||c===null)p[m]=c;else if(c.constructor!==Object&&(u=s.get(c.constructor)))p[m]=u(c,o);else if(ArrayBuffer.isView(c))p[m]=T(c);else{let O=r.indexOf(c);O!==-1?p[m]=a[O]:p[m]=o(c)}}return p}function n(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return t(l,n);if(l.constructor!==Object&&(u=s.get(l.constructor)))return u(l,n);let o={};r.push(l),a.push(o);for(let f in l){if(Object.hasOwnProperty.call(l,f)===!1)continue;let p=l[f];if(typeof p!="object"||p===null)o[f]=p;else if(p.constructor!==Object&&(u=s.get(p.constructor)))o[f]=u(p,n);else if(ArrayBuffer.isView(p))o[f]=T(p);else{let d=r.indexOf(p);d!==-1?o[f]=a[d]:o[f]=n(p)}}return r.pop(),a.pop(),o}function i(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return t(l,i);if(l.constructor!==Object&&(u=s.get(l.constructor)))return u(l,i);let o={};r.push(l),a.push(o);for(let f in l){let p=l[f];if(typeof p!="object"||p===null)o[f]=p;else if(p.constructor!==Object&&(u=s.get(p.constructor)))o[f]=u(p,i);else if(ArrayBuffer.isView(p))o[f]=T(p);else{let d=r.indexOf(p);d!==-1?o[f]=a[d]:o[f]=i(p)}}return r.pop(),a.pop(),o}}});var Gr={};Fe(Gr,{defaults:()=>Ie,remSep:()=>Qr,version:()=>zr});var Be={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function b(e,r){if(!Array.isArray(e)||!e.length)return e;let a=g(g({},Be),r),s,u;if(a.strictlyTwoElementsInRangeArrays&&!e.every((i,l)=>!Array.isArray(i)||i.length!==2?(s=l,u=i.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) has not two but ${u} elements!`);if(!e.every((i,l)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(s=l,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) does not consist of only natural numbers!`);let t=e.length**2,n=0;return Array.from(e).sort((i,l)=>(a.progressFn&&(n+=1,a.progressFn(Math.floor(n*100/t))),i[0]===l[0]?i[1]<l[1]?-1:i[1]>l[1]?1:0:i[0]<l[0]?-1:1))}var B={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function M(e,r){function a(o){return!!o&&typeof o=="object"&&!Array.isArray(o)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(a(r)){if(s=g(g({},B),r),s.progressFn&&a(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
${JSON.stringify(r,null,4)} (type ${typeof r})`);else s=g({},B);let u=e.filter(o=>Array.isArray(o)).map(o=>[...o]).filter(o=>o[2]!==void 0||o[0]!==o[1]),t,n,i;s.progressFn?t=b(u,{progressFn:o=>{i=Math.floor(o/5),i!==n&&(n=i,s.progressFn(i))}}):t=b(u);let l=t.length-1;for(let o=l;o>0;o--)s.progressFn&&(i=Math.floor((1-o/l)*78)+21,i!==n&&i>n&&(n=i,s.progressFn(i))),(t[o][0]<=t[o-1][0]||!s.joinRangesThatTouchEdges&&t[o][0]<t[o-1][1]||s.joinRangesThatTouchEdges&&t[o][0]<=t[o-1][1])&&(t[o-1][0]=Math.min(t[o][0],t[o-1][0]),t[o-1][1]=Math.max(t[o][1],t[o-1][1]),t[o][2]!==void 0&&(t[o-1][0]>=t[o][0]||t[o-1][1]<=t[o][1])&&t[o-1][2]!==null&&(t[o][2]===null&&t[o-1][2]!==null?t[o-1][2]=null:t[o-1][2]!=null?+s.mergeType==2&&t[o-1][0]===t[o][0]?t[o-1][2]=t[o][2]:t[o-1][2]+=t[o][2]:t[o-1][2]=t[o][2]),t.splice(o,1),o=t.length);return t.length?t:null}var Me=!0,R="Invariant failed";function H(e,r){if(!e){if(Me)throw new Error(R);var a=typeof r=="function"?r():r,s=a?"".concat(R,": ").concat(a):R;throw new Error(s)}}function J(e,r,a){let s=0,u=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(a&&typeof a!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof a}, equal to: ${JSON.stringify(a,null,4)}`);if(!(r!=null&&r.filter(f=>f).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let n=t.length,i=0;t.filter(f=>f).forEach((f,p)=>{if(a&&(s=Math.floor(i/n*10),s!==u&&(u=s,a(s))),!Array.isArray(f))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}th element not an array: ${JSON.stringify(f,null,4)}, which is ${typeof f}`);if(!Number.isInteger(f[0])){if(!Number.isInteger(+f[0])||+f[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(f,null,0)}. Its first element is not an integer, string index, but ${typeof f[0]}, equal to: ${JSON.stringify(f[0],null,4)}.`);t[p][0]=+t[p][0]}if(!Number.isInteger(f[1])){if(!Number.isInteger(+f[1])||+f[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(f,null,0)}. Its second element is not an integer, string index, but ${typeof f[1]}, equal to: ${JSON.stringify(f[1],null,4)}.`);t[p][1]=+t[p][1]}i+=1});let l=M(t,{progressFn:f=>{a&&(s=10+Math.floor(f/10),s!==u&&(u=s,a(s)))}});H(l);let o=l.length;if(o>0){let f=e.slice(l[o-1][1]);e=l.reduce((p,d,m,c)=>{a&&(s=20+Math.floor(m/o*80),s!==u&&(u=s,a(s)));let O=m===0?0:c[m-1][1],Ee=c[m][0];return`${p}${e.slice(O,Ee)}${c[m][2]||""}`},""),e+=f}return e}function S(e,r=1){let a="\xA0";function s(t){return Array.from(t).reverse().join("")}function u(t,n,i){let l=i?`
`:"\r",o=i?"\r":`
`;if(!t)return t;let f=0,p=0,d="";for(let m=0,c=t.length;m<c;m++)(t[m]===l||t[m]===o&&t[m-1]!==l)&&p++,`\r
`.includes(t[m])||t[m]===a?(f=0,t[m]===a?d+=t[m]:t[m]===l?p<=n&&(d+=t[m],t[m+1]===o&&(d+=t[m+1],m++)):t[m]===o&&(t==null?void 0:t[m-1])!==l&&p<=n&&(d+=t[m])):(f++,!t[m+1]&&!p&&(d+=" "));return d}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let n="",i="";if(!e.trim())n=e;else if(!e[0].trim()){for(let l=0,o=e.length;l<o;l++)if(e[l].trim()){n=e.slice(0,l);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===a)){for(let l=e.length;l--;)if(e[l].trim()){i=e.slice(l+1);break}}return`${u(n,t,!1)}${e.trim()}${s(u(s(i),t,!0))}`}return e}var P=_e(q(),1);var it=(0,P.default)();function w(e){return typeof e=="string"}function x(e){return Number.isSafeInteger(e)&&e>=0}function y(e){return e!=null}var V={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Le(e,r){var o;function a(f){return!!f&&typeof f=="object"&&!Array.isArray(f)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(a(r)){if(s=g(g({},V),r),s.progressFn&&a(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:
${JSON.stringify(r,null,4)} (type ${typeof r})`);else s=g({},V);let u=e.filter(f=>Array.isArray(f)).map(f=>[...f]).filter(f=>f[2]!==void 0||f[0]!==f[1]),t,n,i;s.progressFn?t=b(u,{progressFn:f=>{i=Math.floor(f/5),i!==n&&(n=i,s.progressFn!=null&&s.progressFn(i))}}):t=b(u);let l=t.length-1;for(let f=l;f>0;f--)s.progressFn&&(i=Math.floor((1-f/l)*78)+21,i!==n&&i>n&&(n=i,s.progressFn(i))),(t[f][0]<=t[f-1][0]||!s.joinRangesThatTouchEdges&&t[f][0]<t[f-1][1]||s.joinRangesThatTouchEdges&&t[f][0]<=t[f-1][1])&&(t[f-1][0]=Math.min(t[f][0],t[f-1][0]),t[f-1][1]=Math.max(t[f][1],t[f-1][1]),t[f][2]!==void 0&&(t[f-1][0]>=t[f][0]||t[f-1][1]<=t[f][1])&&t[f-1][2]!==null&&(t[f][2]===null&&t[f-1][2]!==null?t[f-1][2]=null:t[f-1][2]!=null?+((o=s||{})==null?void 0:o.mergeType)==2&&t[f-1][0]===t[f][0]?t[f-1][2]=t[f][2]:t[f-1][2]+=t[f][2]:t[f-1][2]=t[f][2]),t.splice(f,1),f=t.length);return t.length?t:null}var qe={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},U=class{constructor(e){j(this,"ranges");j(this,"opts");let r=g(g({},qe),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(w(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(w(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType,null,4)}`);this.opts=r,this.ranges=[]}add(e,r,a){var t;if(e==null&&r==null)return;if(y(e)&&!y(r)){if(Array.isArray(e)){if(e.length){if(e.some(n=>Array.isArray(n))){e.forEach(n=>{Array.isArray(n)&&this.add(...n)});return}e.length&&x(+e[0])&&x(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(r,null,0)})`)}else if(!y(e)&&y(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(r,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let s=+e,u=+r;if(x(a)&&(a=String(a)),x(s)&&x(u)){if(y(a)&&!w(a)&&!x(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:
${JSON.stringify(a,null,4)}`);if(y(this.ranges)&&Array.isArray(this.last())&&s===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&y(a)){let n=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${a}`:a;this.opts.limitToBeAddedWhitespace&&(n=S(n,this.opts.limitLinebreaksCount)),w(n)&&!n.length||(this.last()[2]=n)}}else{this.ranges||(this.ranges=[]);let n=a!==void 0&&!(w(a)&&!a.length)?[s,u,a&&this.opts.limitToBeAddedWhitespace?S(a,this.opts.limitLinebreaksCount):a]:[s,u];this.ranges.push(n)}}else throw x(s)&&s>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof u}" equal to: ${JSON.stringify(u,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof s}" equal to: ${JSON.stringify(s,null,4)}`)}push(e,r,a){this.add(e,r,a)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Le(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>y(e[2])?[e[0],e[1],S(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])&&x(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var Pe=typeof global=="object"&&global&&global.Object===Object&&global,K=Pe;var Ve=typeof self=="object"&&self&&self.Object===Object&&self,Ue=K||Ve||Function("return this")(),z=Ue;var Ke=z.Symbol,h=Ke;var Q=Object.prototype,ze=Q.hasOwnProperty,Qe=Q.toString,$=h?h.toStringTag:void 0;function Ge(e){var r=ze.call(e,$),a=e[$];try{e[$]=void 0;var s=!0}catch(t){}var u=Qe.call(e);return s&&(r?e[$]=a:delete e[$]),u}var G=Ge;var Ze=Object.prototype,Ye=Ze.toString;function Xe(e){return Ye.call(e)}var Z=Xe;var er="[object Null]",rr="[object Undefined]",Y=h?h.toStringTag:void 0;function tr(e){return e==null?e===void 0?rr:er:Y&&Y in Object(e)?G(e):Z(e)}var X=tr;function or(e){return e!=null&&typeof e=="object"}var ee=or;var ar="[object Symbol]";function sr(e){return typeof e=="symbol"||ee(e)&&X(e)==ar}var re=sr;function nr(e,r){for(var a=-1,s=e==null?0:e.length,u=Array(s);++a<s;)u[a]=r(e[a],a,e);return u}var te=nr;var fr=Array.isArray,oe=fr;var lr=1/0,ae=h?h.prototype:void 0,se=ae?ae.toString:void 0;function ne(e){if(typeof e=="string")return e;if(oe(e))return te(e,ne)+"";if(re(e))return se?se.call(e):"";var r=e+"";return r=="0"&&1/e==-lr?"-0":r}var v=ne;var ir=/\s/;function ur(e){for(var r=e.length;r--&&ir.test(e.charAt(r)););return r}var fe=ur;var pr=/^\s+/;function mr(e){return e&&e.slice(0,fe(e)+1).replace(pr,"")}var le=mr;function dr(e,r,a,s){for(var u=e.length,t=a+(s?1:-1);s?t--:++t<u;)if(r(e[t],t,e))return t;return-1}var ie=dr;function cr(e){return e!==e}var ue=cr;function gr(e,r,a){for(var s=a-1,u=e.length;++s<u;)if(e[s]===r)return s;return-1}var pe=gr;function xr(e,r,a){return r===r?pe(e,r,a):ie(e,ue,a)}var I=xr;function yr(e){return e==null?"":v(e)}var me=yr;function hr(e,r,a){var s=-1,u=e.length;r<0&&(r=-r>u?0:u+r),a=a>u?u:a,a<0&&(a+=u),u=r>a?0:a-r>>>0,r>>>=0;for(var t=Array(u);++s<u;)t[s]=e[s+r];return t}var de=hr;function br(e,r,a){var s=e.length;return a=a===void 0?s:a,!r&&a>=s?e:de(e,r,a)}var ce=br;var Tr="\\ud800-\\udfff",wr="\\u0300-\\u036f",Ar="\\ufe20-\\ufe2f",$r="\\u20d0-\\u20ff",Or=wr+Ar+$r,Sr="\\ufe0e\\ufe0f",vr="\\u200d",Ir=RegExp("["+vr+Tr+Or+Sr+"]");function Er(e){return Ir.test(e)}var ge=Er;function jr(e){return e.split("")}var xe=jr;var ye="\\ud800-\\udfff",Rr="\\u0300-\\u036f",Dr="\\ufe20-\\ufe2f",Nr="\\u20d0-\\u20ff",kr=Rr+Dr+Nr,Wr="\\ufe0e\\ufe0f",Fr="["+ye+"]",D="["+kr+"]",N="\\ud83c[\\udffb-\\udfff]",_r="(?:"+D+"|"+N+")",he="[^"+ye+"]",be="(?:\\ud83c[\\udde6-\\uddff]){2}",Te="[\\ud800-\\udbff][\\udc00-\\udfff]",Cr="\\u200d",we=_r+"?",Ae="["+Wr+"]?",Br="(?:"+Cr+"(?:"+[he,be,Te].join("|")+")"+Ae+we+")*",Mr=Ae+we+Br,Hr="(?:"+[he+D+"?",D,be,Te,Fr].join("|")+")",Jr=RegExp(N+"(?="+N+")|"+Hr+Mr,"g");function Lr(e){return e.match(Jr)||[]}var $e=Lr;function qr(e){return ge(e)?$e(e):xe(e)}var k=qr;function Pr(e,r){for(var a=e.length;a--&&I(r,e[a],0)>-1;);return a}var Oe=Pr;function Vr(e,r){for(var a=-1,s=e.length;++a<s&&I(r,e[a],0)>-1;);return a}var Se=Vr;function Ur(e,r,a){if(e=me(e),e&&(a||r===void 0))return le(e);if(!e||!(r=v(r)))return e;var s=k(e),u=k(r),t=Se(s,u),n=Oe(s,u)+1;return ce(s,t,n).join("")}var W=Ur;var ve="7.0.20";var zr=ve,Ie={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function Qr(e,r){let a=!0,s=[".",",","'"," "],u;if(typeof e!="string")throw new TypeError(`string-remove-thousand-separators/remSep(): [THROW_ID_01] Input must be string! Currently it's: ${typeof e}, equal to:
${JSON.stringify(e,null,4)}`);if(r&&typeof r!="object")throw new TypeError(`string-remove-thousand-separators/remSep(): [THROW_ID_02] Options object must be a plain object! Currently it's: ${typeof r}, equal to:
${JSON.stringify(r,null,4)}`);let t=g(g({},Ie),r),n=W(e.trim(),'"');if(n==="")return n;if(+e>0&&+e<1)return e;let i=new U;for(let o=0,f=n.length;o<f;o++){if(t.removeThousandSeparatorsFromNumbers&&n[o].trim()===""&&i.add(o,o+1),t.removeThousandSeparatorsFromNumbers&&n[o]==="'"&&(i.add(o,o+1),n[o+1]==="'")){a=!1;break}if(s.includes(n[o])){if(n[o+1]!==void 0&&/^\d$/.test(n[o+1]))if(n[o+2]!==void 0)if(/^\d$/.test(n[o+2]))if(n[o+3]!==void 0)if(/^\d$/.test(n[o+3])){if(n[o+4]!==void 0&&/^\d$/.test(n[o+4])){a=!1;break}else if(t.removeThousandSeparatorsFromNumbers&&i.add(o,o+1),!u)u=n[o];else if(n[o]!==u){a=!1;break}}else{a=!1;break}else t.removeThousandSeparatorsFromNumbers&&t.forceUKStyle&&n[o]===","&&i.add(o,o+1,".");else{a=!1;break}else t.forceUKStyle&&n[o]===","&&i.add(o,o+1,"."),t.padSingleDecimalPlaceNumbers&&i.add(o+2,o+2,"0")}else if(!/^\d$/.test(n[o])){a=!1;break}}return a&&i.current()?J(n,i.current()):n}return Ce(Gr);})();
/**
* @name ranges-sort
* @fileoverview Sort string index ranges
* @version 6.0.14
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/ranges-sort/}
*/
/**
* @name ranges-merge
* @fileoverview Merge and sort string index ranges
* @version 9.0.19
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/ranges-merge/}
*/
/**
* @name ranges-apply
* @fileoverview Take an array of string index ranges, delete/replace the string according to them
* @version 7.0.20
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/ranges-apply/}
*/
/**
* @name string-collapse-leading-whitespace
* @fileoverview Collapse the leading and trailing whitespace of a string
* @version 7.0.9
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/string-collapse-leading-whitespace/}
*/
/**
* @name codsen-utils
* @fileoverview Various utility functions
* @version 1.6.8
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/codsen-utils/}
*/
/**
* @name ranges-push
* @fileoverview Gather string index ranges
* @version 7.0.19
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/ranges-push/}
*/
/*! Bundled license information:
lodash-es/lodash.js:
(**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
*/