{"version":3,"file":"randomstring.js","names":["LOWERCASE","UPPERCASE","DIGITS","randomString","len","randomStringFrom","randomLowercaseString","randomUppercaseString","chars","ret","i","charAt","Math","floor","random","length"],"sources":["../src/randomstring.ts"],"sourcesContent":["/*\nCopyright 2018 New Vector Ltd\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nconst LOWERCASE = \"abcdefghijklmnopqrstuvwxyz\";\nconst UPPERCASE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\nconst DIGITS = \"0123456789\";\n\nexport function randomString(len: number): string {\n return randomStringFrom(len, UPPERCASE + LOWERCASE + DIGITS);\n}\n\nexport function randomLowercaseString(len: number): string {\n return randomStringFrom(len, LOWERCASE);\n}\n\nexport function randomUppercaseString(len: number): string {\n return randomStringFrom(len, UPPERCASE);\n}\n\nfunction randomStringFrom(len: number, chars: string): string {\n let ret = \"\";\n\n for (let i = 0; i < len; ++i) {\n ret += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return ret;\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG,4BAA4B;AAC9C,MAAMC,SAAS,GAAG,4BAA4B;AAC9C,MAAMC,MAAM,GAAG,YAAY;AAEpB,SAASC,YAAYA,CAACC,GAAW,EAAU;EAC9C,OAAOC,gBAAgB,CAACD,GAAG,EAAEH,SAAS,GAAGD,SAAS,GAAGE,MAAM,CAAC;AAChE;AAEO,SAASI,qBAAqBA,CAACF,GAAW,EAAU;EACvD,OAAOC,gBAAgB,CAACD,GAAG,EAAEJ,SAAS,CAAC;AAC3C;AAEO,SAASO,qBAAqBA,CAACH,GAAW,EAAU;EACvD,OAAOC,gBAAgB,CAACD,GAAG,EAAEH,SAAS,CAAC;AAC3C;AAEA,SAASI,gBAAgBA,CAACD,GAAW,EAAEI,KAAa,EAAU;EAC1D,IAAIC,GAAG,GAAG,EAAE;EAEZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,GAAG,EAAE,EAAEM,CAAC,EAAE;IAC1BD,GAAG,IAAID,KAAK,CAACG,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,EAAE,GAAGN,KAAK,CAACO,MAAM,CAAC,CAAC;EACjE;EAEA,OAAON,GAAG;AACd"}