UNPKG

address-faker

Version:
9 lines (8 loc) 32.6 kB
var s=class extends Error{};var le=23283064365386963e-26,oe=1/9007199254740992,{imul:B,trunc:U}=Math;function K(i){return typeof i=="number"?H(i):se(i)}function H(i){let e=Array.from({length:624});e[0]=i;for(let a=1;a!==624;++a){let r=e[a-1]^e[a-1]>>>30;e[a]=U(B(1812433253,r)+a)}return e}function se(i){let e=H(19650218),a=1,r=0;for(let n=Math.max(624,i.length);n!==0;--n){let t=e[a-1]^e[a-1]>>>30;e[a]=U((e[a]^B(t,1664525))+i[r]+r),a++,r++,a>=624&&(e[0]=e[623],a=1),r>=i.length&&(r=0)}for(let n=623;n!==0;n--)e[a]=U((e[a]^B(e[a-1]^e[a-1]>>>30,1566083941))-a),a++,a>=624&&(e[0]=e[623],a=1);return e[0]=2147483648,e}function O(i){for(let a=0;a!==227;++a){let r=(i[a]&2147483648)+(i[a+1]&2147483647);i[a]=i[a+397]^r>>>1^-(r&1)&2567483615}for(let a=227;a!==623;++a){let r=(i[a]&2147483648)+(i[a+1]&2147483647);i[a]=i[a+397-624]^r>>>1^-(r&1)&2567483615}let e=(i[623]&2147483648)+(i[0]&2147483647);return i[623]=i[396]^e>>>1^-(e&1)&2567483615,i}var y=class{constructor(e=Math.random()*Number.MAX_SAFE_INTEGER,a=O(K(e)),r=0){this.states=a;this.index=r}nextU32(){let e=this.states[this.index];return e^=this.states[this.index]>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,++this.index>=624&&(this.states=O(this.states),this.index=0),e>>>0}nextF32(){return this.nextU32()*le}nextU53(){let e=this.nextU32()>>>5,a=this.nextU32()>>>6;return e*67108864+a}nextF53(){return this.nextU53()*oe}seed(e){this.states=O(K(e)),this.index=0}};function A(){return Math.ceil(Math.random()*Number.MAX_SAFE_INTEGER)}function Ee(i=A()){let e=new y(i);return{next(){return e.nextF32()},seed(a){e.seed(a)}}}function $(i=A()){let e=new y(i);return{next(){return e.nextF53()},seed(a){e.seed(a)}}}function V(i){let e=Object.getPrototypeOf(i);do{for(let a of Object.getOwnPropertyNames(e))typeof i[a]=="function"&&a!=="constructor"&&(i[a]=i[a].bind(i));e=Object.getPrototypeOf(e)}while(e!==Object.prototype)}var b=class{constructor(e){this.faker=e;V(this)}},R=class extends b{constructor(a){super(a);this.faker=a}};var M=class extends b{boolean(e={}){typeof e=="number"&&(e={probability:e});let{probability:a=.5}=e;return a<=0?!1:a>=1?!0:this.faker.number.float()<a}};var ue=/\.|\(/;function z(i,e,a=[e,e.rawDefinitions]){if(i.length===0)throw new s("Eval expression cannot be empty.");if(a.length===0)throw new s("Eval entrypoints cannot be empty.");let r=a,n=i;do{let o;n.startsWith("(")?[o,r]=he(n,r,i):[o,r]=ce(n,r),n=n.substring(o),r=r.filter(l=>l!=null).map(l=>Array.isArray(l)?e.helpers.arrayElement(l):l)}while(n.length>0&&r.length>0);if(r.length===0)throw new s(`Cannot resolve expression '${i}'`);let t=r[0];return typeof t=="function"?t():t}function he(i,e,a){let[r,n]=me(i),t=i[r+1];switch(t){case".":case"(":case void 0:break;default:throw new s(`Expected dot ('.'), open parenthesis ('('), or nothing after function call but got '${t}'`)}return[r+(t==="."?2:1),e.map(o=>typeof o=="function"?o(...n):(console.warn(`[@faker-js/faker]: Invoking expressions which are not functions is deprecated since v9.0 and will be removed in v10.0. Please remove the parentheses or replace the expression with an actual function. ${a} ${" ".repeat(a.length-i.length)}^`),o))]}function me(i){let e=i.indexOf(")",1);if(e===-1)throw new s(`Missing closing parenthesis in '${i}'`);for(;e!==-1;){let r=i.substring(1,e);try{return[e,JSON.parse(`[${r}]`)]}catch{if(!r.includes("'")&&!r.includes('"'))try{return[e,JSON.parse(`["${r}"]`)]}catch{}}e=i.indexOf(")",e+1)}e=i.lastIndexOf(")");let a=i.substring(1,e);return[e,[a]]}function ce(i,e){let a=ue.exec(i),r=(a?.[0]??"")===".",n=a?.index??i.length,t=i.substring(0,n);if(t.length===0)throw new s(`Expression parts cannot be empty in '${i}'`);let o=i[n+1];if(r&&(o==null||o==="."||o==="("))throw new s(`Found dot without property name in '${i}'`);return[n+(r?1:0),e.map(l=>pe(l,t))]}function pe(i,e){switch(typeof i){case"function":{try{i=i()}catch{return}return i?.[e]}case"object":return i?.[e];default:return}}function Z(i){let e=fe(i.replace(/L?$/,"0"));return e===0?0:10-e}function fe(i){i=i.replaceAll(/[\s-]/g,"");let e=0,a=!1;for(let r=i.length-1;r>=0;r--){let n=Number.parseInt(i[r]);a&&(n*=2,n>9&&(n=n%10+1)),e+=n,a=!a}return e%10}function W(i,e,a,r){let n=1;if(e)switch(e){case"?":{n=i.datatype.boolean()?0:1;break}case"*":{let t=1;for(;i.datatype.boolean();)t*=2;n=i.number.int({min:0,max:t});break}case"+":{let t=1;for(;i.datatype.boolean();)t*=2;n=i.number.int({min:1,max:t});break}default:throw new s("Unknown quantifier symbol provided.")}else a!=null&&r!=null?n=i.number.int({min:Number.parseInt(a),max:Number.parseInt(r)}):a!=null&&r==null&&(n=Number.parseInt(a));return n}function de(i,e=""){let a=/(.)\{(\d+),(\d+)\}/,r=/(.)\{(\d+)\}/,n=/\[(\d+)-(\d+)\]/,t,o,l,h,u=a.exec(e);for(;u!=null;)t=Number.parseInt(u[2]),o=Number.parseInt(u[3]),t>o&&(l=o,o=t,t=l),h=i.number.int({min:t,max:o}),e=e.slice(0,u.index)+u[1].repeat(h)+e.slice(u.index+u[0].length),u=a.exec(e);for(u=r.exec(e);u!=null;)h=Number.parseInt(u[2]),e=e.slice(0,u.index)+u[1].repeat(h)+e.slice(u.index+u[0].length),u=r.exec(e);for(u=n.exec(e);u!=null;)t=Number.parseInt(u[1]),o=Number.parseInt(u[2]),t>o&&(l=o,o=t,t=l),e=e.slice(0,u.index)+i.number.int({min:t,max:o}).toString()+e.slice(u.index+u[0].length),u=n.exec(e);return e}function be(i,e="",a="#"){let r="";for(let n=0;n<e.length;n++)e.charAt(n)===a?r+=i.number.int(9):e.charAt(n)==="!"?r+=i.number.int({min:2,max:9}):r+=e.charAt(n);return r}var k=class extends b{slugify(e=""){return e.normalize("NFKD").replaceAll(/[\u0300-\u036F]/g,"").replaceAll(" ","-").replaceAll(/[^\w.-]+/g,"")}replaceSymbols(e=""){let a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],r="";for(let n=0;n<e.length;n++)e.charAt(n)==="#"?r+=this.faker.number.int(9):e.charAt(n)==="?"?r+=this.arrayElement(a):e.charAt(n)==="*"?r+=this.faker.datatype.boolean()?this.arrayElement(a):this.faker.number.int(9):r+=e.charAt(n);return r}replaceCreditCardSymbols(e="6453-####-####-####-###L",a="#"){e=de(this.faker,e),e=be(this.faker,e,a);let r=Z(e);return e.replace("L",String(r))}fromRegExp(e){let a=!1;e instanceof RegExp&&(a=e.flags.includes("i"),e=e.toString(),e=/\/(.+?)\//.exec(e)?.[1]??"");let r,n,t,o=/([.A-Za-z0-9])(?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/,l=o.exec(e);for(;l!=null;){let P=l[2],G=l[3],F=l[4];t=W(this.faker,F,P,G);let x;l[1]==="."?x=this.faker.string.alphanumeric(t):a?x=this.faker.string.fromCharacters([l[1].toLowerCase(),l[1].toUpperCase()],t):x=l[1].repeat(t),e=e.slice(0,l.index)+x+e.slice(l.index+l[0].length),l=o.exec(e)}let h=/(\d-\d|\w-\w|\d|\w|[-!@#$&()`.+,/"])/,u=/\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+)|)/;for(l=u.exec(e);l!=null;){let P=l[1]==="^",G=l[2]==="-",F=l[4],x=l[5],te=l[6],p=[],w=l[3],g=h.exec(w);for(G&&p.push(45);g!=null;){if(g[0].includes("-")){let d=g[0].split("-").map(m=>m.codePointAt(0)??Number.NaN);if(r=d[0],n=d[1],r>n)throw new s("Character range provided is out of order.");for(let m=r;m<=n;m++)if(a&&Number.isNaN(Number(String.fromCodePoint(m)))){let v=String.fromCodePoint(m);p.push(v.toUpperCase().codePointAt(0)??Number.NaN,v.toLowerCase().codePointAt(0)??Number.NaN)}else p.push(m)}else a&&Number.isNaN(Number(g[0]))?p.push(g[0].toUpperCase().codePointAt(0)??Number.NaN,g[0].toLowerCase().codePointAt(0)??Number.NaN):p.push(g[0].codePointAt(0)??Number.NaN);w=w.substring(g[0].length),g=h.exec(w)}if(t=W(this.faker,te,F,x),P){let d=-1;for(let m=48;m<=57;m++){if(d=p.indexOf(m),d>-1){p.splice(d,1);continue}p.push(m)}for(let m=65;m<=90;m++){if(d=p.indexOf(m),d>-1){p.splice(d,1);continue}p.push(m)}for(let m=97;m<=122;m++){if(d=p.indexOf(m),d>-1){p.splice(d,1);continue}p.push(m)}}let ie=this.multiple(()=>String.fromCodePoint(this.arrayElement(p)),{count:t}).join("");e=e.slice(0,l.index)+ie+e.slice(l.index+l[0].length),l=u.exec(e)}let f=/(.)\{(\d+),(\d+)\}/;for(l=f.exec(e);l!=null;){if(r=Number.parseInt(l[2]),n=Number.parseInt(l[3]),r>n)throw new s("Numbers out of order in {} quantifier.");t=this.faker.number.int({min:r,max:n}),e=e.slice(0,l.index)+l[1].repeat(t)+e.slice(l.index+l[0].length),l=f.exec(e)}let c=/(.)\{(\d+)\}/;for(l=c.exec(e);l!=null;)t=Number.parseInt(l[2]),e=e.slice(0,l.index)+l[1].repeat(t)+e.slice(l.index+l[0].length),l=c.exec(e);return e}shuffle(e,a={}){let{inplace:r=!1}=a;r||(e=[...e]);for(let n=e.length-1;n>0;--n){let t=this.faker.number.int(n);[e[n],e[t]]=[e[t],e[n]]}return e}uniqueArray(e,a){if(Array.isArray(e)){let t=[...new Set(e)];return this.shuffle(t).splice(0,a)}let r=new Set;try{if(typeof e=="function"){let n=1e3*a,t=0;for(;r.size<a&&t<n;)r.add(e()),t++}}catch{}return[...r]}mustache(e,a){if(e==null)return"";for(let r in a){let n=new RegExp(`{{${r}}}`,"g"),t=a[r];typeof t=="string"&&(t=t.replaceAll("$","$$$$")),e=e.replace(n,t)}return e}maybe(e,a={}){if(this.faker.datatype.boolean(a))return e()}objectKey(e){let a=Object.keys(e);return this.arrayElement(a)}objectValue(e){let a=this.faker.helpers.objectKey(e);return e[a]}objectEntry(e){let a=this.faker.helpers.objectKey(e);return[a,e[a]]}arrayElement(e){if(e.length===0)throw new s("Cannot get value from empty dataset.");let a=e.length>1?this.faker.number.int({max:e.length-1}):0;return e[a]}weightedArrayElement(e){if(e.length===0)throw new s("weightedArrayElement expects an array with at least one element");if(!e.every(t=>t.weight>0))throw new s("weightedArrayElement expects an array of { weight, value } objects where weight is a positive number");let a=e.reduce((t,{weight:o})=>t+o,0),r=this.faker.number.float({min:0,max:a}),n=0;for(let{weight:t,value:o}of e)if(n+=t,r<n)return o;return e.at(-1).value}arrayElements(e,a){if(e.length===0)return[];let r=this.rangeToNumber(a??{min:1,max:e.length});if(r>=e.length)return this.shuffle(e);if(r<=0)return[];let n=[...e],t=e.length,o=t-r,l,h;for(;t-- >o;)h=this.faker.number.int(t),l=n[h],n[h]=n[t],n[t]=l;return n.slice(o)}enumValue(e){let a=Object.keys(e).filter(n=>Number.isNaN(Number(n))),r=this.arrayElement(a);return e[r]}rangeToNumber(e){return typeof e=="number"?e:this.faker.number.int(e)}multiple(e,a={}){let r=this.rangeToNumber(a.count??3);return r<=0?[]:Array.from({length:r},e)}},N=class extends k{constructor(a){super(a);this.faker=a}fake(a){a=typeof a=="string"?a:this.arrayElement(a);let r=a.search(/{{[a-z]/),n=a.indexOf("}}",r);if(r===-1||n===-1)return a;let o=a.substring(r+2,n+2).replace("}}","").replace("{{",""),l=z(o,this.faker),h=String(l),u=a.substring(0,r)+h+a.substring(n+2);return this.fake(u)}};var _="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function Y(i){let e=i.valueOf(),a="";for(let r=10;r>0;r--){let n=e%32;a=_[n]+a,e=(e-n)/32}return a}function X(i,e="refDate"){let a=new Date(i);if(Number.isNaN(a.valueOf()))throw new s(`Invalid ${e} date: ${i.toString()}`);return a}var E=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],C=[..."abcdefghijklmnopqrstuvwxyz"],J=[..."0123456789"],S=class extends b{fromCharacters(e,a=1){if(a=this.faker.helpers.rangeToNumber(a),a<=0)return"";if(typeof e=="string"&&(e=[...e]),e.length===0)throw new s("Unable to generate string: No characters to select from.");return this.faker.helpers.multiple(()=>this.faker.helpers.arrayElement(e),{count:a}).join("")}alpha(e={}){typeof e=="number"&&(e={length:e});let a=this.faker.helpers.rangeToNumber(e.length??1);if(a<=0)return"";let{casing:r="mixed"}=e,{exclude:n=[]}=e;typeof n=="string"&&(n=[...n]);let t;switch(r){case"upper":{t=[...E];break}case"lower":{t=[...C];break}case"mixed":{t=[...C,...E];break}}return t=t.filter(o=>!n.includes(o)),this.fromCharacters(t,a)}alphanumeric(e={}){typeof e=="number"&&(e={length:e});let a=this.faker.helpers.rangeToNumber(e.length??1);if(a<=0)return"";let{casing:r="mixed"}=e,{exclude:n=[]}=e;typeof n=="string"&&(n=[...n]);let t=[...J];switch(r){case"upper":{t.push(...E);break}case"lower":{t.push(...C);break}case"mixed":{t.push(...C,...E);break}}return t=t.filter(o=>!n.includes(o)),this.fromCharacters(t,a)}binary(e={}){let{prefix:a="0b"}=e,r=a;return r+=this.fromCharacters(["0","1"],e.length??1),r}octal(e={}){let{prefix:a="0o"}=e,r=a;return r+=this.fromCharacters(["0","1","2","3","4","5","6","7"],e.length??1),r}hexadecimal(e={}){let{casing:a="mixed",prefix:r="0x"}=e,n=this.faker.helpers.rangeToNumber(e.length??1);if(n<=0)return r;let t=this.fromCharacters(["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","A","B","C","D","E","F"],n);return a==="upper"?t=t.toUpperCase():a==="lower"&&(t=t.toLowerCase()),`${r}${t}`}numeric(e={}){typeof e=="number"&&(e={length:e});let a=this.faker.helpers.rangeToNumber(e.length??1);if(a<=0)return"";let{allowLeadingZeros:r=!0}=e,{exclude:n=[]}=e;typeof n=="string"&&(n=[...n]);let t=J.filter(l=>!n.includes(l));if(t.length===0||t.length===1&&!r&&t[0]==="0")throw new s("Unable to generate numeric string, because all possible digits are excluded.");let o="";return!r&&!n.includes("0")&&(o+=this.faker.helpers.arrayElement(t.filter(l=>l!=="0"))),o+=this.fromCharacters(t,a-o.length),o}sample(e=10){e=this.faker.helpers.rangeToNumber(e);let a={min:33,max:125},r="";for(;r.length<e;)r+=String.fromCodePoint(this.faker.number.int(a));return r}uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll("x",()=>this.faker.number.hex({min:0,max:15})).replaceAll("y",()=>this.faker.number.hex({min:8,max:11}))}ulid(e={}){let{refDate:a=this.faker.defaultRefDate()}=e,r=X(a);return Y(r)+this.fromCharacters(_,16)}nanoid(e=21){if(e=this.faker.helpers.rangeToNumber(e),e<=0)return"";let a=[{value:()=>this.alphanumeric(1),weight:62},{value:()=>this.faker.helpers.arrayElement(["_","-"]),weight:2}],r="";for(;r.length<e;){let n=this.faker.helpers.weightedArrayElement(a);r+=n()}return r}symbol(e=1){return this.fromCharacters(["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_","`","{","|","}","~"],e)}};var L=class extends b{int(e={}){typeof e=="number"&&(e={max:e});let{min:a=0,max:r=Number.MAX_SAFE_INTEGER,multipleOf:n=1}=e;if(!Number.isInteger(n))throw new s("multipleOf should be an integer.");if(n<=0)throw new s("multipleOf should be greater than 0.");let t=Math.ceil(a/n),o=Math.floor(r/n);if(t===o)return t*n;if(o<t)throw r>=a?new s(`No suitable integer value between ${a} and ${r} found.`):new s(`Max ${r} should be greater than min ${a}.`);let h=this.faker._randomizer.next(),u=o-t+1;return Math.floor(h*u+t)*n}float(e={}){typeof e=="number"&&(e={max:e});let{min:a=0,max:r=1,fractionDigits:n,multipleOf:t,multipleOf:o=n==null?void 0:10**-n}=e;if(r<a)throw new s(`Max ${r} should be greater than min ${a}.`);if(n!=null){if(t!=null)throw new s("multipleOf and fractionDigits cannot be set at the same time.");if(!Number.isInteger(n))throw new s("fractionDigits should be an integer.");if(n<0)throw new s("fractionDigits should be greater than or equal to 0.")}if(o!=null){if(o<=0)throw new s("multipleOf should be greater than 0.");let u=Math.log10(o),f=o<1&&Number.isInteger(u)?10**-u:1/o;return this.int({min:a*f,max:r*f})/f}return this.faker._randomizer.next()*(r-a)+a}binary(e={}){typeof e=="number"&&(e={max:e});let{min:a=0,max:r=1}=e;return this.int({max:r,min:a}).toString(2)}octal(e={}){typeof e=="number"&&(e={max:e});let{min:a=0,max:r=7}=e;return this.int({max:r,min:a}).toString(8)}hex(e={}){typeof e=="number"&&(e={max:e});let{min:a=0,max:r=15}=e;return this.int({max:r,min:a}).toString(16)}bigInt(e={}){(typeof e=="bigint"||typeof e=="number"||typeof e=="string"||typeof e=="boolean")&&(e={max:e});let a=BigInt(e.min??0),r=BigInt(e.max??a+BigInt(999999999999999)),n=BigInt(e.multipleOf??1);if(r<a)throw new s(`Max ${r} should be larger than min ${a}.`);if(n<=BigInt(0))throw new s("multipleOf should be greater than 0.");let t=a/n+(a%n>0n?1n:0n),o=r/n-(r%n<0n?1n:0n);if(t===o)return t*n;if(o<t)throw new s(`No suitable bigint value between ${a} and ${r} found.`);let l=o-t+1n,h=BigInt(this.faker.string.numeric({length:l.toString(10).length,allowLeadingZeros:!0}))%l;return(t+h)*n}romanNumeral(e={}){typeof e=="number"&&(e={max:e});let{min:n=1,max:t=3999}=e;if(n<1)throw new s(`Min value ${n} should be 1 or greater.`);if(t>3999)throw new s(`Max value ${t} should be 3999 or less.`);let o=this.int({min:n,max:t}),l=[["M",1e3],["CM",900],["D",500],["CD",400],["C",100],["XC",90],["L",50],["XL",40],["X",10],["IX",9],["V",5],["IV",4],["I",1]],h="";for(let[u,f]of l)h+=u.repeat(Math.floor(o/f)),o%=f;return h}};var T=class{_defaultRefDate=()=>new Date;get defaultRefDate(){return this._defaultRefDate}setDefaultRefDate(e=()=>new Date){typeof e=="function"?this._defaultRefDate=e:this._defaultRefDate=()=>new Date(e)}_randomizer;datatype=new M(this);helpers=new k(this);number=new L(this);string=new S(this);constructor(e={}){let{randomizer:a,seed:r}=e;a!=null&&r!=null&&a.seed(r),this._randomizer=a??$(r)}seed(e=A()){return this._randomizer.seed(e),e}},ia=new T;function j(i){let e={};for(let a of i)for(let r in a){let n=a[r];e[r]===void 0?e[r]={...n}:e[r]={...n,...e[r]}}return e}function Q(i){let{deprecated:e,since:a,until:r,proposed:n}=i,t=`[@faker-js/faker]: ${e} is deprecated`;a&&(t+=` since v${a}`),r&&(t+=` and will be removed in v${r}`),n&&(t+=`. Please use ${n} instead`),console.warn(`${t}.`)}var D=()=>{throw new s("You cannot edit the locale data on the faker instance")};function q(i){let e={};return new Proxy(i,{has(){return!0},get(a,r){return typeof r=="symbol"||r==="nodeType"?a[r]:r in e?e[r]:e[r]=xe(r,a[r])},set:D,deleteProperty:D})}function ge(i,...e){if(i===null)throw new s(`The locale data for '${e.join(".")}' aren't applicable to this locale. If you think this is a bug, please report it at: https://github.com/faker-js/faker`);if(i===void 0)throw new s(`The locale data for '${e.join(".")}' are missing in this locale. If this is a custom Faker instance, please make sure all required locales are used e.g. '[de_AT, de, en, base]'. Please contribute the missing data to the project or use a locale/Faker instance that has these data. For more information see https://fakerjs.dev/guide/localization.html`)}function xe(i,e={}){return new Proxy(e,{has(a,r){return a[r]!=null},get(a,r){let n=a[r];return typeof r=="symbol"||r==="nodeType"||ge(n,i,r.toString()),n},set:D,deleteProperty:D})}var I=class extends R{zipCode(e={}){typeof e=="string"&&(e={format:e});let{state:a}=e;if(a!=null){let n=this.faker.definitions.location.postcode_by_state[a];if(n==null)throw new s(`No zip code definition found for state "${a}"`);return this.faker.helpers.fake(n)}let{format:r=this.faker.definitions.location.postcode}=e;return typeof r=="string"&&(r=[r]),r=this.faker.helpers.arrayElement(r),this.faker.helpers.replaceSymbols(r)}city(){return this.faker.helpers.fake(this.faker.definitions.location.city_pattern)}buildingNumber(){return this.faker.helpers.arrayElement(this.faker.definitions.location.building_number).replaceAll(/#+/g,e=>this.faker.string.numeric({length:e.length,allowLeadingZeros:!1}))}street(){return this.faker.helpers.fake(this.faker.definitions.location.street_pattern)}streetAddress(e={}){typeof e=="boolean"&&(e={useFullAddress:e});let{useFullAddress:a}=e,n=this.faker.definitions.location.street_address[a?"full":"normal"];return this.faker.helpers.fake(n)}secondaryAddress(){return this.faker.helpers.fake(this.faker.definitions.location.secondary_address).replaceAll(/#+/g,e=>this.faker.string.numeric({length:e.length,allowLeadingZeros:!1}))}county(){return this.faker.helpers.arrayElement(this.faker.definitions.location.county)}country(){return this.faker.helpers.arrayElement(this.faker.definitions.location.country)}continent(){return this.faker.helpers.arrayElement(this.faker.definitions.location.continent)}countryCode(e={}){typeof e=="string"&&(e={variant:e});let{variant:a="alpha-2"}=e,r=(()=>{switch(a){case"numeric":return"numeric";case"alpha-3":return"alpha3";case"alpha-2":return"alpha2"}})();return this.faker.helpers.arrayElement(this.faker.definitions.location.country_code)[r]}state(e={}){let{abbreviated:a=!1}=e,r=a?this.faker.definitions.location.state_abbr:this.faker.definitions.location.state;return this.faker.helpers.arrayElement(r)}latitude(e={}){let{max:a=90,min:r=-90,precision:n=4}=e;return this.faker.number.float({min:r,max:a,fractionDigits:n})}longitude(e={}){let{max:a=180,min:r=-180,precision:n=4}=e;return this.faker.number.float({max:a,min:r,fractionDigits:n})}direction(e={}){let{abbreviated:a=!1}=e;return a?this.faker.helpers.arrayElement([...this.faker.definitions.location.direction.cardinal_abbr,...this.faker.definitions.location.direction.ordinal_abbr]):this.faker.helpers.arrayElement([...this.faker.definitions.location.direction.cardinal,...this.faker.definitions.location.direction.ordinal])}cardinalDirection(e={}){let{abbreviated:a=!1}=e;return a?this.faker.helpers.arrayElement(this.faker.definitions.location.direction.cardinal_abbr):this.faker.helpers.arrayElement(this.faker.definitions.location.direction.cardinal)}ordinalDirection(e={}){let{abbreviated:a=!1}=e;return a?this.faker.helpers.arrayElement(this.faker.definitions.location.direction.ordinal_abbr):this.faker.helpers.arrayElement(this.faker.definitions.location.direction.ordinal)}nearbyGPSCoordinate(e={}){let{origin:a,radius:r=10,isMetric:n=!1}=e;if(a==null)return[this.latitude(),this.longitude()];let t=this.faker.number.float({max:2*Math.PI,fractionDigits:5}),o=n?r:r*1.60934,h=this.faker.number.float({max:o,fractionDigits:3})*.995,u=4e4/360,f=h/u,c=[a[0]+Math.sin(t)*f,a[1]+Math.cos(t)*f];return c[0]=c[0]%180,(c[0]<-90||c[0]>90)&&(c[0]=Math.sign(c[0])*180-c[0],c[1]+=180),c[1]=(c[1]%360+540)%360-180,[c[0],c[1]]}timeZone(){return this.faker.helpers.arrayElement(this.faker.definitions.location.time_zone)}language(){return this.faker.helpers.arrayElement(this.faker.definitions.location.language)}};var ee=class extends T{rawDefinitions;definitions;location=new I(this);helpers=new N(this);get address(){return Q({deprecated:"faker.address",proposed:"faker.location",since:"8.0",until:"10.0"}),this.location}constructor(e){super({randomizer:e.randomizer,seed:e.seed});let{locale:a}=e;if(Array.isArray(a)){if(a.length===0)throw new s("The locale option must contain at least one locale definition.");a=j(a)}this.rawDefinitions=a,this.definitions=q(this.rawDefinitions)}getMetadata(){return this.rawDefinitions.metadata??{}}};var ae=[{alpha2:"AD",alpha3:"AND",numeric:"020"},{alpha2:"AE",alpha3:"ARE",numeric:"784"},{alpha2:"AF",alpha3:"AFG",numeric:"004"},{alpha2:"AG",alpha3:"ATG",numeric:"028"},{alpha2:"AI",alpha3:"AIA",numeric:"660"},{alpha2:"AL",alpha3:"ALB",numeric:"008"},{alpha2:"AM",alpha3:"ARM",numeric:"051"},{alpha2:"AO",alpha3:"AGO",numeric:"024"},{alpha2:"AQ",alpha3:"ATA",numeric:"010"},{alpha2:"AR",alpha3:"ARG",numeric:"032"},{alpha2:"AS",alpha3:"ASM",numeric:"016"},{alpha2:"AT",alpha3:"AUT",numeric:"040"},{alpha2:"AU",alpha3:"AUS",numeric:"036"},{alpha2:"AW",alpha3:"ABW",numeric:"533"},{alpha2:"AX",alpha3:"ALA",numeric:"248"},{alpha2:"AZ",alpha3:"AZE",numeric:"031"},{alpha2:"BA",alpha3:"BIH",numeric:"070"},{alpha2:"BB",alpha3:"BRB",numeric:"052"},{alpha2:"BD",alpha3:"BGD",numeric:"050"},{alpha2:"BE",alpha3:"BEL",numeric:"056"},{alpha2:"BF",alpha3:"BFA",numeric:"854"},{alpha2:"BG",alpha3:"BGR",numeric:"100"},{alpha2:"BH",alpha3:"BHR",numeric:"048"},{alpha2:"BI",alpha3:"BDI",numeric:"108"},{alpha2:"BJ",alpha3:"BEN",numeric:"204"},{alpha2:"BL",alpha3:"BLM",numeric:"652"},{alpha2:"BM",alpha3:"BMU",numeric:"060"},{alpha2:"BN",alpha3:"BRN",numeric:"096"},{alpha2:"BO",alpha3:"BOL",numeric:"068"},{alpha2:"BQ",alpha3:"BES",numeric:"535"},{alpha2:"BR",alpha3:"BRA",numeric:"076"},{alpha2:"BS",alpha3:"BHS",numeric:"044"},{alpha2:"BT",alpha3:"BTN",numeric:"064"},{alpha2:"BV",alpha3:"BVT",numeric:"074"},{alpha2:"BW",alpha3:"BWA",numeric:"072"},{alpha2:"BY",alpha3:"BLR",numeric:"112"},{alpha2:"BZ",alpha3:"BLZ",numeric:"084"},{alpha2:"CA",alpha3:"CAN",numeric:"124"},{alpha2:"CC",alpha3:"CCK",numeric:"166"},{alpha2:"CD",alpha3:"COD",numeric:"180"},{alpha2:"CF",alpha3:"CAF",numeric:"140"},{alpha2:"CG",alpha3:"COG",numeric:"178"},{alpha2:"CH",alpha3:"CHE",numeric:"756"},{alpha2:"CI",alpha3:"CIV",numeric:"384"},{alpha2:"CK",alpha3:"COK",numeric:"184"},{alpha2:"CL",alpha3:"CHL",numeric:"152"},{alpha2:"CM",alpha3:"CMR",numeric:"120"},{alpha2:"CN",alpha3:"CHN",numeric:"156"},{alpha2:"CO",alpha3:"COL",numeric:"170"},{alpha2:"CR",alpha3:"CRI",numeric:"188"},{alpha2:"CU",alpha3:"CUB",numeric:"192"},{alpha2:"CV",alpha3:"CPV",numeric:"132"},{alpha2:"CW",alpha3:"CUW",numeric:"531"},{alpha2:"CX",alpha3:"CXR",numeric:"162"},{alpha2:"CY",alpha3:"CYP",numeric:"196"},{alpha2:"CZ",alpha3:"CZE",numeric:"203"},{alpha2:"DE",alpha3:"DEU",numeric:"276"},{alpha2:"DJ",alpha3:"DJI",numeric:"262"},{alpha2:"DK",alpha3:"DNK",numeric:"208"},{alpha2:"DM",alpha3:"DMA",numeric:"212"},{alpha2:"DO",alpha3:"DOM",numeric:"214"},{alpha2:"DZ",alpha3:"DZA",numeric:"012"},{alpha2:"EC",alpha3:"ECU",numeric:"218"},{alpha2:"EE",alpha3:"EST",numeric:"233"},{alpha2:"EG",alpha3:"EGY",numeric:"818"},{alpha2:"EH",alpha3:"ESH",numeric:"732"},{alpha2:"ER",alpha3:"ERI",numeric:"232"},{alpha2:"ES",alpha3:"ESP",numeric:"724"},{alpha2:"ET",alpha3:"ETH",numeric:"231"},{alpha2:"FI",alpha3:"FIN",numeric:"246"},{alpha2:"FJ",alpha3:"FJI",numeric:"242"},{alpha2:"FK",alpha3:"FLK",numeric:"238"},{alpha2:"FM",alpha3:"FSM",numeric:"583"},{alpha2:"FO",alpha3:"FRO",numeric:"234"},{alpha2:"FR",alpha3:"FRA",numeric:"250"},{alpha2:"GA",alpha3:"GAB",numeric:"266"},{alpha2:"GB",alpha3:"GBR",numeric:"826"},{alpha2:"GD",alpha3:"GRD",numeric:"308"},{alpha2:"GE",alpha3:"GEO",numeric:"268"},{alpha2:"GF",alpha3:"GUF",numeric:"254"},{alpha2:"GG",alpha3:"GGY",numeric:"831"},{alpha2:"GH",alpha3:"GHA",numeric:"288"},{alpha2:"GI",alpha3:"GIB",numeric:"292"},{alpha2:"GL",alpha3:"GRL",numeric:"304"},{alpha2:"GM",alpha3:"GMB",numeric:"270"},{alpha2:"GN",alpha3:"GIN",numeric:"324"},{alpha2:"GP",alpha3:"GLP",numeric:"312"},{alpha2:"GQ",alpha3:"GNQ",numeric:"226"},{alpha2:"GR",alpha3:"GRC",numeric:"300"},{alpha2:"GS",alpha3:"SGS",numeric:"239"},{alpha2:"GT",alpha3:"GTM",numeric:"320"},{alpha2:"GU",alpha3:"GUM",numeric:"316"},{alpha2:"GW",alpha3:"GNB",numeric:"624"},{alpha2:"GY",alpha3:"GUY",numeric:"328"},{alpha2:"HK",alpha3:"HKG",numeric:"344"},{alpha2:"HM",alpha3:"HMD",numeric:"334"},{alpha2:"HN",alpha3:"HND",numeric:"340"},{alpha2:"HR",alpha3:"HRV",numeric:"191"},{alpha2:"HT",alpha3:"HTI",numeric:"332"},{alpha2:"HU",alpha3:"HUN",numeric:"348"},{alpha2:"ID",alpha3:"IDN",numeric:"360"},{alpha2:"IE",alpha3:"IRL",numeric:"372"},{alpha2:"IL",alpha3:"ISR",numeric:"376"},{alpha2:"IM",alpha3:"IMN",numeric:"833"},{alpha2:"IN",alpha3:"IND",numeric:"356"},{alpha2:"IO",alpha3:"IOT",numeric:"086"},{alpha2:"IQ",alpha3:"IRQ",numeric:"368"},{alpha2:"IR",alpha3:"IRN",numeric:"364"},{alpha2:"IS",alpha3:"ISL",numeric:"352"},{alpha2:"IT",alpha3:"ITA",numeric:"380"},{alpha2:"JE",alpha3:"JEY",numeric:"832"},{alpha2:"JM",alpha3:"JAM",numeric:"388"},{alpha2:"JO",alpha3:"JOR",numeric:"400"},{alpha2:"JP",alpha3:"JPN",numeric:"392"},{alpha2:"KE",alpha3:"KEN",numeric:"404"},{alpha2:"KG",alpha3:"KGZ",numeric:"417"},{alpha2:"KH",alpha3:"KHM",numeric:"116"},{alpha2:"KI",alpha3:"KIR",numeric:"296"},{alpha2:"KM",alpha3:"COM",numeric:"174"},{alpha2:"KN",alpha3:"KNA",numeric:"659"},{alpha2:"KP",alpha3:"PRK",numeric:"408"},{alpha2:"KR",alpha3:"KOR",numeric:"410"},{alpha2:"KW",alpha3:"KWT",numeric:"414"},{alpha2:"KY",alpha3:"CYM",numeric:"136"},{alpha2:"KZ",alpha3:"KAZ",numeric:"398"},{alpha2:"LA",alpha3:"LAO",numeric:"418"},{alpha2:"LB",alpha3:"LBN",numeric:"422"},{alpha2:"LC",alpha3:"LCA",numeric:"662"},{alpha2:"LI",alpha3:"LIE",numeric:"438"},{alpha2:"LK",alpha3:"LKA",numeric:"144"},{alpha2:"LR",alpha3:"LBR",numeric:"430"},{alpha2:"LS",alpha3:"LSO",numeric:"426"},{alpha2:"LT",alpha3:"LTU",numeric:"440"},{alpha2:"LU",alpha3:"LUX",numeric:"442"},{alpha2:"LV",alpha3:"LVA",numeric:"428"},{alpha2:"LY",alpha3:"LBY",numeric:"434"},{alpha2:"MA",alpha3:"MAR",numeric:"504"},{alpha2:"MC",alpha3:"MCO",numeric:"492"},{alpha2:"MD",alpha3:"MDA",numeric:"498"},{alpha2:"ME",alpha3:"MNE",numeric:"499"},{alpha2:"MF",alpha3:"MAF",numeric:"663"},{alpha2:"MG",alpha3:"MDG",numeric:"450"},{alpha2:"MH",alpha3:"MHL",numeric:"584"},{alpha2:"MK",alpha3:"MKD",numeric:"807"},{alpha2:"ML",alpha3:"MLI",numeric:"466"},{alpha2:"MM",alpha3:"MMR",numeric:"104"},{alpha2:"MN",alpha3:"MNG",numeric:"496"},{alpha2:"MO",alpha3:"MAC",numeric:"446"},{alpha2:"MP",alpha3:"MNP",numeric:"580"},{alpha2:"MQ",alpha3:"MTQ",numeric:"474"},{alpha2:"MR",alpha3:"MRT",numeric:"478"},{alpha2:"MS",alpha3:"MSR",numeric:"500"},{alpha2:"MT",alpha3:"MLT",numeric:"470"},{alpha2:"MU",alpha3:"MUS",numeric:"480"},{alpha2:"MV",alpha3:"MDV",numeric:"462"},{alpha2:"MW",alpha3:"MWI",numeric:"454"},{alpha2:"MX",alpha3:"MEX",numeric:"484"},{alpha2:"MY",alpha3:"MYS",numeric:"458"},{alpha2:"MZ",alpha3:"MOZ",numeric:"508"},{alpha2:"NA",alpha3:"NAM",numeric:"516"},{alpha2:"NC",alpha3:"NCL",numeric:"540"},{alpha2:"NE",alpha3:"NER",numeric:"562"},{alpha2:"NF",alpha3:"NFK",numeric:"574"},{alpha2:"NG",alpha3:"NGA",numeric:"566"},{alpha2:"NI",alpha3:"NIC",numeric:"558"},{alpha2:"NL",alpha3:"NLD",numeric:"528"},{alpha2:"NO",alpha3:"NOR",numeric:"578"},{alpha2:"NP",alpha3:"NPL",numeric:"524"},{alpha2:"NR",alpha3:"NRU",numeric:"520"},{alpha2:"NU",alpha3:"NIU",numeric:"570"},{alpha2:"NZ",alpha3:"NZL",numeric:"554"},{alpha2:"OM",alpha3:"OMN",numeric:"512"},{alpha2:"PA",alpha3:"PAN",numeric:"591"},{alpha2:"PE",alpha3:"PER",numeric:"604"},{alpha2:"PF",alpha3:"PYF",numeric:"258"},{alpha2:"PG",alpha3:"PNG",numeric:"598"},{alpha2:"PH",alpha3:"PHL",numeric:"608"},{alpha2:"PK",alpha3:"PAK",numeric:"586"},{alpha2:"PL",alpha3:"POL",numeric:"616"},{alpha2:"PM",alpha3:"SPM",numeric:"666"},{alpha2:"PN",alpha3:"PCN",numeric:"612"},{alpha2:"PR",alpha3:"PRI",numeric:"630"},{alpha2:"PS",alpha3:"PSE",numeric:"275"},{alpha2:"PT",alpha3:"PRT",numeric:"620"},{alpha2:"PW",alpha3:"PLW",numeric:"585"},{alpha2:"PY",alpha3:"PRY",numeric:"600"},{alpha2:"QA",alpha3:"QAT",numeric:"634"},{alpha2:"RE",alpha3:"REU",numeric:"638"},{alpha2:"RO",alpha3:"ROU",numeric:"642"},{alpha2:"RS",alpha3:"SRB",numeric:"688"},{alpha2:"RU",alpha3:"RUS",numeric:"643"},{alpha2:"RW",alpha3:"RWA",numeric:"646"},{alpha2:"SA",alpha3:"SAU",numeric:"682"},{alpha2:"SB",alpha3:"SLB",numeric:"090"},{alpha2:"SC",alpha3:"SYC",numeric:"690"},{alpha2:"SD",alpha3:"SDN",numeric:"729"},{alpha2:"SE",alpha3:"SWE",numeric:"752"},{alpha2:"SG",alpha3:"SGP",numeric:"702"},{alpha2:"SH",alpha3:"SHN",numeric:"654"},{alpha2:"SI",alpha3:"SVN",numeric:"705"},{alpha2:"SJ",alpha3:"SJM",numeric:"744"},{alpha2:"SK",alpha3:"SVK",numeric:"703"},{alpha2:"SL",alpha3:"SLE",numeric:"694"},{alpha2:"SM",alpha3:"SMR",numeric:"674"},{alpha2:"SN",alpha3:"SEN",numeric:"686"},{alpha2:"SO",alpha3:"SOM",numeric:"706"},{alpha2:"SR",alpha3:"SUR",numeric:"740"},{alpha2:"SS",alpha3:"SSD",numeric:"728"},{alpha2:"ST",alpha3:"STP",numeric:"678"},{alpha2:"SV",alpha3:"SLV",numeric:"222"},{alpha2:"SX",alpha3:"SXM",numeric:"534"},{alpha2:"SY",alpha3:"SYR",numeric:"760"},{alpha2:"SZ",alpha3:"SWZ",numeric:"748"},{alpha2:"TC",alpha3:"TCA",numeric:"796"},{alpha2:"TD",alpha3:"TCD",numeric:"148"},{alpha2:"TF",alpha3:"ATF",numeric:"260"},{alpha2:"TG",alpha3:"TGO",numeric:"768"},{alpha2:"TH",alpha3:"THA",numeric:"764"},{alpha2:"TJ",alpha3:"TJK",numeric:"762"},{alpha2:"TK",alpha3:"TKL",numeric:"772"},{alpha2:"TL",alpha3:"TLS",numeric:"626"},{alpha2:"TM",alpha3:"TKM",numeric:"795"},{alpha2:"TN",alpha3:"TUN",numeric:"788"},{alpha2:"TO",alpha3:"TON",numeric:"776"},{alpha2:"TR",alpha3:"TUR",numeric:"792"},{alpha2:"TT",alpha3:"TTO",numeric:"780"},{alpha2:"TV",alpha3:"TUV",numeric:"798"},{alpha2:"TW",alpha3:"TWN",numeric:"158"},{alpha2:"TZ",alpha3:"TZA",numeric:"834"},{alpha2:"UA",alpha3:"UKR",numeric:"804"},{alpha2:"UG",alpha3:"UGA",numeric:"800"},{alpha2:"UM",alpha3:"UMI",numeric:"581"},{alpha2:"US",alpha3:"USA",numeric:"840"},{alpha2:"UY",alpha3:"URY",numeric:"858"},{alpha2:"UZ",alpha3:"UZB",numeric:"860"},{alpha2:"VA",alpha3:"VAT",numeric:"336"},{alpha2:"VC",alpha3:"VCT",numeric:"670"},{alpha2:"VE",alpha3:"VEN",numeric:"862"},{alpha2:"VG",alpha3:"VGB",numeric:"092"},{alpha2:"VI",alpha3:"VIR",numeric:"850"},{alpha2:"VN",alpha3:"VNM",numeric:"704"},{alpha2:"VU",alpha3:"VUT",numeric:"548"},{alpha2:"WF",alpha3:"WLF",numeric:"876"},{alpha2:"WS",alpha3:"WSM",numeric:"882"},{alpha2:"YE",alpha3:"YEM",numeric:"887"},{alpha2:"YT",alpha3:"MYT",numeric:"175"},{alpha2:"ZA",alpha3:"ZAF",numeric:"710"},{alpha2:"ZM",alpha3:"ZMB",numeric:"894"},{alpha2:"ZW",alpha3:"ZWE",numeric:"716"}];var ye={country_code:ae},re=ye;var Ae={title:"Base",code:"base"},ne=Ae;var ke={location:re,metadata:ne},Ca=ke;export{s as a,Ee as b,$ as c,T as d,ia as e,j as f,ee as g,Ca as h};