import{__}from"@wordpress/i18n";export class ScCheckoutUnsavedChangesWarning{constructor(){this.state=void 0}componentDidLoad(){window.addEventListener("beforeunload",(e=>this.warnIfUnsavedChanges(e)),{capture:!0})}warnIfUnsavedChanges(e){if(["updating","finalizing","confirming"].includes(this.state))return console.log({e:e}),e.preventDefault(),e.returnValue=__("Your payment is processing. Exiting this page could cause an error in your order. Please do not navigate away from this page.","surecart"),e.returnValue}static get is(){return"sc-checkout-unsaved-changes-warning"}static get encapsulation(){return"shadow"}static get properties(){return{state:{type:"string",mutable:!1,complexType:{original:"FormState",resolved:'"confirmed" | "confirming" | "draft" | "expired" | "failure" | "finalizing" | "idle" | "loading" | "paid" | "paying" | "redirecting" | "updating"',references:{FormState:{location:"import",path:"../../../types",id:"src/types.ts::FormState"}}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"state",reflect:!1}}}}