import{r as e}from"./chunk-QTnfLwEv.js";import{n as t}from"./index-7yDgay5u.js";import{i as n,o as r,t as i}from"./jsx-runtime-DHSfUA5-.js";import{P as a,T as o}from"./test.id-DxQrYxPk.js";import{t as s}from"./useSuccessToast-CW8oLO3e.js";import{n as c,t as l}from"./membershipService-iYu9OIlX.js";import{t as u}from"./HeaderLayoutPage-CDZOzzod.js";import{t as d}from"./useTopTips-B9oW_JMO.js";import{n as f}from"./index-9BPhDxrb.js";import{t as p}from"./useLoadingToast-BBb6RyKX.js";import{n as m,t as h}from"./FormPage-B0BqbKo9.js";import{t as g}from"./useForm-YVjhCM4e.js";var _=e(r(),1),v=i();function y(){let e=a(l),r=p(),i=s(),y=d(),[b,x]=(0,_.useState)(!1),S=g({fields:[{name:`orderId`,label:t(`settings.membership.mbdOrderId`,`Order ID`),testId:o.mbdOrderId,placeholder:t(`settings.membership.mbdOrderIdPlaceholder`,`Enter order ID`),required:!0}],requiredMessage:e=>t(`settings.sync.s3.required`,`{0} is required.`,e.label)}),C=async(e,t)=>{if(b)return;let n=r();x(!0);try{await f(c,await e(),{revalidate:!1}),i({message:t}),S.reset()}catch(e){y({message:e instanceof Error?e.message:String(e)})}finally{x(!1),n.dispose()}};return(0,v.jsx)(u,{rootClassName:n.Page.SurfaceRoot,contentClassName:n.S3SettingsPage.SetupContent,pageTestId:o.mbdPage,contentTestId:o.mbdContent,header:{tone:`surface`,showBack:!0},children:(0,v.jsx)(h,{title:t(`settings.membership.redeemMbdChannel`,`Redeem MBD`),description:t(`settings.membership.mbdRedeemStep`,`Enter order ID to redeem.`),actions:[{label:b?t(`settings.membership.processing`,`Processing...`):t(`settings.membership.redeemMbd`,`Redeem`),disabled:b,testId:o.redeemMbd,onClick:()=>{if(!S.verify())return;let n=String(S.values.orderId).trim();C(()=>e.redeemMbdOrder(n),t(`settings.membership.activated`,`Membership activated`))}}],children:(0,v.jsx)(m,{title:t(`settings.membership.redeemOrder`,`Redeem order`),items:S.fields})})})}export{y as SettingsMembershipMianbaoduoPage};
//# sourceMappingURL=mianbaoduo-DZ8K0Z68.js.map