!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lazy-assert/check-basic")):"function"==typeof define&&define.amd?define(["exports","@lazy-assert/check-basic"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BlueloversToRegexRange={},e.checkBasic)}(this,(function(e,t){"use strict";const n=Symbol.for("SymCache");function isAllowedValue(e){return!0===t.isUnSafeNumLike(e)&&("string"!=typeof e||/^-?\d+$/.test(e))}function toRegexRange(e,t,r){if(!isAllowedValue(e))throw new TypeError(`toRegexRange: expected the first argument '${e}' to be a number like.`);if(void 0===t||e===t)return String(e);if(!isAllowedValue(t))throw new TypeError(`toRegexRange: expected the second argument '${t}' to be a number like.`);e=String(e),t=String(t);let a={relaxZeros:!0,...r};"boolean"==typeof a.strictZeros&&(a.relaxZeros=!1===a.strictZeros);let o=e+":"+t+"="+String(a.relaxZeros)+String(a.shorthand)+String(a.capture)+String(a.wrap);if(toRegexRange[n].hasOwnProperty(o))return toRegexRange[n][o].result;let i=Math.min(e,t),s=Math.max(e,t);if(1===Math.abs(i-s)){let n=e+"|"+t;return a.capture?`(${n})`:!1===a.wrap?n:`(?:${n})`}let u=hasPadding(e)||hasPadding(t),l={min:e,max:t,a:i,b:s},g=[],c=[];return u&&(l.isPadded=u,l.maxLen=String(l.max).length),i<0&&(c=splitToPatterns(s<0?Math.abs(s):1,Math.abs(i),l,a),i=l.a=0),s>=0&&(g=splitToPatterns(i,s,l,a)),l.negatives=c,l.positives=g,l.result=function collatePatterns(e,t,n){let r=filterPatterns(e,t,"-",!1)||[],a=filterPatterns(t,e,"",!1)||[],o=filterPatterns(e,t,"-?",!0)||[];return r.concat(o).concat(a).join("|")}(c,g),!0===a.capture?l.result=`(${l.result})`:!1!==a.wrap&&g.length+c.length>1&&(l.result=`(?:${l.result})`),toRegexRange[n][o]=l,l.result}function rangeToPattern(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function zip(e,t){let n=[];for(let r=0;r1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+toQuantifier(a.count),s=t+1)}return i}function filterPatterns(e,t,n,r,a){let o=[];for(let a of e){let{string:e}=a;r||contains(t,"string",e)||o.push(n+e),r&&contains(t,"string",e)&&o.push(n+e)}return o}function compare(e,t){return e>t?1:t>e?-1:0}function contains(e,t,n){return e.some((e=>e[t]===n))}function countNines(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function countZeros(e,t){return e-e%Math.pow(10,t)}function toQuantifier(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function hasPadding(e){return/^-?(0+)\d/.test(e)}function padZeros(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),a=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:return a?`0{0,${r}}`:`0{${r}}`}}toRegexRange[n]={},toRegexRange.clearCache=()=>toRegexRange[n]={},Object.defineProperty(toRegexRange,"toRegexRange",{value:toRegexRange}),Object.defineProperty(toRegexRange,"default",{value:toRegexRange}),Object.defineProperty(toRegexRange,"SymCache",{value:n}),e.SymCache=n,e.default=toRegexRange,e.toRegexRange=toRegexRange,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=index.umd.production.min.cjs.map