"use strict";var g=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(l,e)=>{for(var n in e)g(l,n,{get:e[n],enumerable:!0})},y=(l,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of b(e))!p.call(l,r)&&r!==n&&g(l,r,{get:()=>e[r],enumerable:!(t=o(e,r))||t.enumerable});return l};var C=l=>y(g({},"__esModule",{value:!0}),l);var k={};d(k,{StringModule:()=>A});module.exports=C(k);var x=require("../../errors/faker-error"),c=require("../../internal/module-base");const m=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],u=[..."abcdefghijklmnopqrstuvwxyz"],f=[..."0123456789"];class A extends c.SimpleModuleBase{fromCharacters(e,n=1){if(n=this.faker.helpers.rangeToNumber(n),n<=0)return"";if(typeof e=="string"&&(e=[...e]),e.length===0)throw new x.FakerError("Unable to generate string: No characters to select from.");return this.faker.helpers.multiple(()=>this.faker.helpers.arrayElement(e),{count:n}).join("")}alpha(e={}){var i;typeof e=="number"&&(e={length:e});const n=this.faker.helpers.rangeToNumber((i=e.length)!=null?i:1);if(n<=0)return"";const{casing:t="mixed"}=e;let{exclude:r=[]}=e;typeof r=="string"&&(r=[...r]);let a;switch(t){case"upper":a=[...m];break;case"lower":a=[...u];break;case"mixed":default:a=[...u,...m];break}return a=a.filter(s=>!r.includes(s)),this.fromCharacters(a,n)}alphanumeric(e={}){var i;typeof e=="number"&&(e={length:e});const n=this.faker.helpers.rangeToNumber((i=e.length)!=null?i:1);if(n<=0)return"";const{casing:t="mixed"}=e;let{exclude:r=[]}=e;typeof r=="string"&&(r=[...r]);let a=[...f];switch(t){case"upper":a.push(...m);break;case"lower":a.push(...u);break;case"mixed":default:a.push(...u,...m);break}return a=a.filter(s=>!r.includes(s)),this.fromCharacters(a,n)}binary(e={}){var r;const{prefix:n="0b"}=e;let t=n;return t+=this.fromCharacters(["0","1"],(r=e.length)!=null?r:1),t}octal(e={}){var r;const{prefix:n="0o"}=e;let t=n;return t+=this.fromCharacters(["0","1","2","3","4","5","6","7"],(r=e.length)!=null?r:1),t}hexadecimal(e={}){var i;const{casing:n="mixed",prefix:t="0x"}=e,r=this.faker.helpers.rangeToNumber((i=e.length)!=null?i:1);if(r<=0)return t;let a=this.fromCharacters(["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","A","B","C","D","E","F"],r);return n==="upper"?a=a.toUpperCase():n==="lower"&&(a=a.toLowerCase()),`${t}${a}`}numeric(e={}){var s;typeof e=="number"&&(e={length:e});const n=this.faker.helpers.rangeToNumber((s=e.length)!=null?s:1);if(n<=0)return"";const{allowLeadingZeros:t=!0}=e;let{exclude:r=[]}=e;typeof r=="string"&&(r=[...r]);const a=f.filter(h=>!r.includes(h));if(a.length===0||a.length===1&&!t&&a[0]==="0")throw new x.FakerError("Unable to generate numeric string, because all possible digits are excluded.");let i="";return!t&&!r.includes("0")&&(i+=this.faker.helpers.arrayElement(a.filter(h=>h!=="0"))),i+=this.fromCharacters(a,n-i.length),i}sample(e=10){e=this.faker.helpers.rangeToNumber(e);const n={min:33,max:125};let t="";for(;t.length<e;)t+=String.fromCharCode(this.faker.number.int(n));return t}uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/x/g,()=>this.faker.number.hex({min:0,max:15})).replace(/y/g,()=>this.faker.number.hex({min:8,max:11}))}nanoid(e=21){if(e=this.faker.helpers.rangeToNumber(e),e<=0)return"";const n=[{value:()=>this.alphanumeric(1),weight:62},{value:()=>this.faker.helpers.arrayElement(["_","-"]),weight:2}];let t="";for(;t.length<e;){const r=this.faker.helpers.weightedArrayElement(n);t+=r()}return t}symbol(e=1){return this.fromCharacters(["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_","`","{","|","}","~"],e)}}0&&(module.exports={StringModule});
