1{"version":3,"file":"resolveHashString.web.js","sourceRoot":"","sources":["../../src/utils/resolveHashString.web.tsx"],"names":[],"mappings":"AAEA;;;;;;;KAOK;AACL,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7E,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE;QAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE;KACnC,CAAC;AACJ,CAAC;AAED;;;;;;;KAOK;AACL,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC9C,OAAO;QACL,GAAG,EAAE,aAAa,GAAG,IAAI;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["import { ImageSource } from '../Image.types';\n\n/**\n * Converts a string in blurhash format (`blurhash:/<hash>/<width>/<height>`\n * or <hash>/<width>/<height>) into an `ImageSource`.\n * Note: The blurhash:/ uri scheme is removed, because for backward compatibility reasons,\n * strings without a scheme are assumed to be `blurhash` by default.\n *\n * @return An ImageSource representing the provided blurhash.\n * */\nexport function resolveBlurhashString(str: string): ImageSource {\n const [blurhash, width, height] = str.replace(/^blurhash:\\//, '').split('/');\n return {\n uri: blurhash,\n width: parseInt(width, 10) || 16,\n height: parseInt(height, 10) || 16,\n };\n}\n\n/**\n * Converts a string in thumbhash format (`thumbhash:/<hash>` or `<hash>`)\n * into an `ImageSource`.\n * Note: Unlike the `resolveBlurhashString` the `thumbhash:/` scheme has to be present,\n * as the scheme has to be explicitly stated to be interpreted a `thumbhash` source.\n *\n * @return An ImageSource representing the provided thumbhash.\n * */\nexport function resolveThumbhashString(str: string): ImageSource {\n const hash = str.replace(/^thumbhash:\\//, '');\n return {\n uri: 'thumbhash:/' + hash,\n };\n}\n"]}