// Metro module 6753 (f6754).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useCallback } from "react";
import { View } from "react-native";
import ThemeStore from "../../user_settings/ThemeStore";
import { VerificationMethod } from "../AgeVerificationConstants";
import { buildIncodeParamsInjection } from "../AgeVerificationIncodeWebViewConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { requestIncodeMethodSession } from "../AgeVerificationURLActionCreators";
import { ActivityIndicator } from "../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Heading, Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import AgeAssurance_messages from "../AgeAssurance.messages";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
let env4340 = {};
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
content: {
padding: Module712.space.PX_16
},
loadingOverlay: {
flex: 1,
alignItems: "center",
justifyContent: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
}
});
export default function AgeVerificationIncodeMethodSelectScreen(props) {
let props2;
let env15897 = {
$parent: env4340
};
const onMethodSelected = props.onMethodSelected;
env15897[0] = onMethodSelected;
const trustedOrigin = props.trustedOrigin;
env15897[1] = trustedOrigin;
env15897[2] = void 0;
env15897[3] = void 0;
env15897[4] = void 0;
const r4 = _slicedToArray(useState(false), 2);
const r26 = r4[0];
env15897[2] = r4[1];
const r30 = _slicedToArray(useState(false), 2);
let r12 = r30[0];
env15897[3] = r30[1];
const styles = useStyles();
let c15898_0 = async (c29835_0) => {
let c29835_3;
let c29835_4 = 0;
let c31437_0, c31437_1, c31437_2;
L13: {
L12: {
try {
c31437_0 = c29835_0;
c31437_1 = void 0;
c31437_2 = void 0;
(0, env15897[2])(true);
(0, env15897[3])(false);
c29835_4 = 2;
c31437_1 = await requestIncodeMethodSession(c29835_0);
if (c31437_1 == null) {
(0, env15897[3])(true);
c29835_4 = 0;
(0, env15897[2])(false);
break L13;
}
c31437_2 = buildIncodeParamsInjection({
apiUrl: c31437_1.apiUrl,
sessionToken: c31437_1.sessionToken,
consentId: c31437_1.consentId,
interviewId: c31437_1.interviewId,
theme: ThemeStore.theme,
method: c31437_0
}, env15897[1]);
(0, env15897[0])(c31437_2);
c29835_4 = 1;
c29835_4 = 0;
(0, env15897[2])(false);
} catch ($e) {
const r30 = $e;
let r7 = r30;
c29835_3 = r30;
let r31 = c29835_4;
if (r31 !== 0) {
while (true) {
if (r31 === 1) {
try {
const r115 = c29835_3;
c29835_4 = 0;
(0, env15897[2])(false);
throw r115;
} catch (r113) {
r7 = r113;
c29835_3 = r113;
r31 = c29835_4;
if (r31 === 0) {
break;
}
}
} else {
try {
c29835_4 = 1;
(0, env15897[3])(true);
c29835_4 = 0;
(0, env15897[2])(false);
break L12;
} catch (r101) {
r7 = r101;
c29835_3 = r101;
r31 = c29835_4;
if (r31 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
env15897[4] = useCallback(function() {
return c15898_0.apply(this, arguments);
}, [onMethodSelected, trustedOrigin]);
const r41 = {
style: null,
children: null
};
if (r26) {
r41.style = styles.loadingOverlay;
r41.children = ;
props2 = r41;
} else {
r41.style = styles.container;
const r59 = [
{intl.string(AgeAssurance_messages.eZvwAe)}
,
{intl.string(AgeAssurance_messages["5yWXmT"])}
, , ,];
if (r12) {
r12 =
{intl.string(t.c6kn6F)}
;
}
r59[2] = r12;
r59[3] =
{
(0, env15897[4])(VerificationMethod.FACIAL_AGE_ESTIMATION);
}} />
{
(0, env15897[4])(VerificationMethod.ID_VERIFICATION);
}} />
;
r41.children = {r59};
props2 = r41;
}
return ;
};