"use strict";var e=require("react/jsx-runtime"),r=require("@heroicons/react/24/outline/PhoneIcon"),i=require("react"),t=require("./ConnectPhoneForm-xFB1DoYY.js"),n=require("./context-rs-ygOK2.js"),o=require("./internal-context-CdsQ3LEl.js"),u=require("./modal-context-BgeioxwT.js"),s=require("./ScreenLayout-DaFW0I3a.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("styled-components"),require("@privy-io/js-sdk-core"),require("./useActiveWallet-dTc6deka.js"),require("viem/utils"),require("./wallet-connect-BuohfvHK.js"),require("./errors-CBapWvRs.js"),require("ofetch"),require("./getPublicClient-CFd_sHBk.js"),require("viem"),require("viem/chains"),require("eventemitter3"),require("./events-context-Di6--rDg.js"),require("./privy-context-UTJouJ1x.js"),require("@privy-io/are-addresses-equal"),require("./index-Ub4KpwSY.js"),require("zustand"),require("react-device-detect"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("./ModalHeader-Cpls13mi.js"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("./Chip-C6r7fZiR.js"),require("./LoadingSkeleton-BoyADunQ.js"),require("tinycolor2"),require("./Screen-8NusMFtu.js"),require("./index-ByFhjjzH.js");var c=/*#__PURE__*/a(r);const l=({title:r="Connect your phone",subtitle:n="Add your number to your account",onSubmit:o,isSubmitting:u=!1})=>{let[a,l]=i.useState(null),q=async()=>{a?.qualifiedPhoneNumber&&await o(a)};/*#__PURE__*/return e.jsx(s.ScreenLayout,{title:r,subtitle:n,icon:c.default,primaryCta:{label:u?"Submitting":"Submit",onClick:q,disabled:!a?.isValid||u},watermark:!0,children:/*#__PURE__*/e.jsx(t.ConnectPhoneNumberForm,{onChange:e=>{l(e)},onSubmit:q,noIncludeSubmitButton:!0,hideRecent:!0})})},q={component:()=>{let{currentScreen:r,data:t,navigate:s,setModalData:a}=u.usePrivyModal(),c=n.useAppConfig(),{initLoginWithSms:q}=o.usePrivyInternal(),[d,m]=i.useState(!1);/*#__PURE__*/return e.jsx(l,{subtitle:`Add your number to your ${c?.name} account`,onSubmit:async e=>{m(!0);try{await q({phoneNumber:e.qualifiedPhoneNumber,withPrivyUi:!0}),s("AwaitingPasswordlessCodeScreen")}catch(e){a({errorModalData:{error:e,previousScreen:t?.errorModalData?.previousScreen||r||"LinkPhoneScreen"}}),s("ErrorScreen")}finally{m(!1)}},isSubmitting:d})}};exports.LinkPhoneScreen=q,exports.LinkPhoneScreenView=l,exports.default=q;
//# sourceMappingURL=LinkPhoneScreen-DcGT4Es-.js.map
