"use strict";const watchers=require("./watchers-db03ec4e.js"),getters=require("./getters-a0ce2d19.js"),mutations=require("./mutations-86c3aa04.js"),store=require("./store-ce062aec.js"),addQueryArgs=require("./add-query-args-49dcb630.js");watchers.on("set",((e,t,r)=>{JSON.stringify(null==t?void 0:t.line_item)!==JSON.stringify(null==r?void 0:r.line_item)&&mutations.preview()})),setInterval((()=>{getters.isUpsellExpired()&&(store.state.loading="complete")}),1e3),store.onChange("line_item",(()=>{var e,t,r;store.state.amount_due=(null===(e=null===store.state||void 0===store.state?void 0:store.state.line_item)||void 0===e?void 0:e.total_amount)+(null!==(r=null===(t=null===store.state||void 0===store.state?void 0:store.state.line_item)||void 0===t?void 0:t.trial_amount)&&void 0!==r?r:0)})),store.onChange("upsell",(e=>{var t;if(!(null==e?void 0:e.permalink))return store.state.loading="complete";store.state.loading="redirecting",window.location.assign(addQueryArgs.addQueryArgs(null==e?void 0:e.permalink,{sc_checkout_id:null===(t=store.state.checkout)||void 0===t?void 0:t.id,sc_form_id:store.state.form_id}))})),store.onChange("loading",(e=>{var t;if("complete"===e){const e=getters.getExitUrl();if(!e)return store.state.loading="complete";store.state.loading="redirecting",window.location.assign(addQueryArgs.addQueryArgs(e,{sc_order:null===(t=store.state.checkout)||void 0===t?void 0:t.id}))}}));