import{getContext as e,store as r}from"@wordpress/interactivity";const{findKey:t}=window.lodash||window._;r("formgent/payment-failed",{state:{getTryButtonText:function(){const r=e();return r.isTrying?r.buttonLoadingText:r.buttonText}},actions:{retryPayment:async function(){const r=e();if(r.isTrying)return;const t=new URLSearchParams(window.location.search).get("order_id");t||alert("Order id not found"),r.isTrying=!0,r.errorMessage=null;try{const e=await(n={path:`/formgent/payment/retry/${t}`,method:"GET"},wp.apiFetch(n));e.redirect_url?window.location.href=e.redirect_url:r.errorMessage=e.message}catch(e){console.error("Retry request failed:",e),r.errorMessage=e.message}finally{r.isTrying=!1}var n}}});