import{r as i,d as p,o as u,c as _,a as e,l as y,v as b,t as x,e as h,z as g,w as k,f as C,i as f,B,C as w,g as N}from"./app-91dba96b.js";import{i as S}from"./index-0653e21c.js";import{u as m}from"./urlGenerator-87d92adb.js";import{_ as I}from"./_plugin-vue_export-helper-c27b6911.js";import"./appFunction-1b5b1f43.js";const n=d=>(B("data-v-d85043d1"),d=d(),w(),d),K={class:"container-fluid pb-5 my-5 installer-container d-flex align-items-center justify-content-center"},V={class:"col-12 col-lg-7 mt-4 mb-4"},D={class:"card"},E=n(()=>e("div",{class:"card-header"},[e("h4",{class:"mt-2 fw-bolder"},[N(" Purchase Code "),e("span",{class:"text-danger"},"*")])],-1)),P={class:"card-body"},T={key:0,class:"text-danger"},j={class:"card-footer d-flex justify-content-center gap-3"},G=["href"],M=n(()=>e("span",null,"Go Back",-1)),R=[M],X=["disabled"],q=n(()=>e("span",null,"Next",-1)),z={__name:"purchaseKey",setup(d){const l=i({purchase_code:""}),s=i({}),o=i(!1),v=()=>{delete axios.defaults.headers.common["X-Requested-With"],delete axios.defaults.headers.common["X-CSRF-TOKEN"],o.value=!0,S.post("purchase-key",l.value).then(a=>{(a==null?void 0:a.data.message)==="success"&&(o.value=!0,axios.get(a==null?void 0:a.data.url).then(t=>{var c;((c=t==null?void 0:t.data)==null?void 0:c.message)==="verified"&&(f.success("Purchase code verified successfully"),location.replace(m(`environment-setup?purchase_code=${l.value.purchase_code}`)))}).catch(({response:t})=>{var c,r;(t==null?void 0:t.status)===422?s.value=(c=t==null?void 0:t.data)==null?void 0:c.errors:f.error((r=t==null?void 0:t.data)==null?void 0:r.message)}).finally(()=>o.value=!1)),s.value={}}).catch(({response:a})=>{(a==null?void 0:a.status)===422&&(s.value=a.data.errors),o.value=!1})};return(a,t)=>{const c=p("app-button-loader");return u(),_("div",K,[e("div",V,[e("div",D,[E,e("div",P,[y(e("input",{type:"text",class:"form-control form-control",id:"purchases_code",placeholder:"Enter Purchase Code","onUpdate:modelValue":t[0]||(t[0]=r=>l.value.purchase_code=r)},null,512),[[b,l.value.purchase_code]]),s.value.purchase_code?(u(),_("small",T,x(s.value.purchase_code[0]),1)):h("",!0)]),e("div",j,[e("a",{href:g(m)("install"),class:"btn btn-danger btn-lg px-4"},R,8,G),e("button",{type:"button",class:"btn btn-primary btn-lg px-4",disabled:o.value,onClick:k(v,["prevent"])},[o.value?(u(),C(c,{key:0})):h("",!0),q],8,X)])])])])}}},A=I(z,[["__scopeId","data-v-d85043d1"]]);export{A as default};
