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AAM,WAAW,GAAO,kBAE7C,CACA,SAAS,WAAW,GAChB,OAAO,OAAO,KAAK,UAAU,EACjC,CAVA,QAAQ,QAAU","file":"/npm/@kevinwolf/use-expo-asset-loader@1.0.0/lib/use-expo-asset-loader.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@kevinwolf/use-expo-asset-loader@1.0.0/lib/use-expo-asset-loader.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst react_1 = require(\"react\");\nconst react_native_1 = require(\"react-native\");\nconst expo_1 = require(\"expo\");\nfunction useAssetLoader(config = {}) {\n    const [isReady, setIsReady] = react_1.useState(false);\n    react_1.useEffect(() => {\n        expo_1.SplashScreen.preventAutoHide();\n    }, []);\n    const loadResourcesRequest = () => __awaiter(this, void 0, void 0, function* () {\n        if (config.images) {\n            yield cacheImages(config.images);\n        }\n        if (config.fonts) {\n            yield cacheFonts(config.fonts);\n        }\n    });\n    const loadResourcesSuccess = () => {\n        setIsReady(true);\n    };\n    const loadResourcesFailure = (error) => {\n        throw new Error(`Error loading resources: ${error.message}`);\n    };\n    return {\n        isReady,\n        getAppLoadingProps() {\n            return {\n                startAsync: loadResourcesRequest,\n                onFinish: loadResourcesSuccess,\n                onError: loadResourcesFailure,\n            };\n        },\n    };\n}\nexports.default = useAssetLoader;\nfunction cacheImages(images) {\n    return Promise.all(images.map((image) => {\n        return typeof image === 'string'\n            ? react_native_1.Image.prefetch(image)\n            : expo_1.Asset.fromModule(image).downloadAsync();\n    }));\n}\nfunction cacheFonts(fonts) {\n    return expo_1.Font.loadAsync(fonts);\n}\n"]}