import{r as c,c as o,a as e,t as s,g as h,b as p,e as m,n as k,f,u as _,o as a,k as v,l as x,x as y}from"./app-43851608.js";import{_ as $}from"./FormInput-4a309017.js";const A={class:"flex h-screen justify-center"},V={class:"flex justify-center"},N={class:"mt-20"},j={class:"flex justify-center mb-5"},M=e("h4",{class:"text-2xl mb-2 text-center"},"Swiftchats",-1),P={class:"text-2xl text-center"},S={key:0,class:"md:w-[20em] p-2"},Z={class:"text-center text-xl mb-4"},B={key:0,class:"mt-4 p-2 bg-slate-200 border-l-[2px] border-red-500 my-4 max-w-[28em] text-sm"},T={class:"mt-2"},E={key:0,href:"/install/database",type:"submit",class:"mt-4 rounded-md bg-primary px-3 py-2 text-sm text-white shadow-sm w-full"},U={key:1,type:"button",class:"mt-4 rounded-md bg-primary px-3 py-2 text-sm text-white shadow-sm w-full flex justify-center"},z=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"}),e("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[e("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})])],-1),D=[z],W={key:1,class:"md:w-[30em] p-2"},q={class:"bg-slate-200 p-2 border-l-[3px] border-red-800 text-sm"},L={class:"flex justify-center gap-x-2"},F={key:0,type:"submit",class:"w-[10em] mt-4 rounded-md bg-primary px-3 py-2 text-sm text-white shadow-sm"},G={key:1,type:"button",class:"w-[10em] mt-4 rounded-md bg-primary px-3 py-2 text-sm text-white shadow-sm flex justify-center"},H=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"}),e("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[e("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})])],-1),I=[H],J={key:2,class:"md:w-[30em] p-2"},K={class:"text-center text-xl mb-4"},O={class:"bg-green-50 p-2 border-l-[3px] border-green-800 mb-2"},Q={class:"bg-slate-100 rounded p-4"},R={class:"bg-slate-200 p-2 rounded-md mt-2"},X={class:"mb-2"},Y={class:"text-sm"},ee={class:"flex gap-x-1"},te={class:"flex justify-between gap-x-2"},ae={__name:"Update",props:["path"],setup(b){const w=b,l=c(null),i=c(!1),r=c(null),g=async()=>{i.value=!0,(await y.post("/update",{purchase_code:d.value.purchase_code})).data.statusCode===200&&(l.value="finish")},d=c({purchase_code:null}),C=async()=>{i.value=!0;try{(await y.post("https://axis96.xyz/api/install/51790966/item",{purchase_code:d.value.purchase_code})).status===200&&(l.value="migrate",r.value=null)}catch(t){t.response?t.response.status===404?r.value=t.response.data.message:r.value=t.response.data.message||"An error occurred":t.request?r.value="Error: No response received":r.value=t.message,l.value=null}finally{i.value=!1}};return(t,n)=>(a(),o("div",A,[e("div",V,[e("div",N,[e("div",j,[e("div",null,[M,e("h1",P,s(t.$t("Proceed to update")),1)])]),l.value===null?(a(),o("div",S,[t.isValidPurchaseCode?p("",!0):(a(),o("form",{key:0,onSubmit:n[1]||(n[1]=h(u=>C(),["prevent"]))},[e("h4",Z,s(t.$t("Enter Purchase Code")),1),r.value!=null?(a(),o("div",B,s(r.value),1)):p("",!0),m($,{modelValue:d.value.purchase_code,"onUpdate:modelValue":n[0]||(n[0]=u=>d.value.purchase_code=u),name:t.$t("Purchase Code"),type:"text",placeholder:"Purchase code",class:k("sm:col-span-6 mb-2")},null,8,["modelValue","name"]),e("div",T,[i.value?(a(),o("button",U,D)):(a(),o("button",E,s(t.$t("Next Step")),1))])],32))])):l.value==="migrate"?(a(),o("div",W,[e("div",q,[e("p",null,s(t.$t("When you click proceed, your script will be updated automatically! Do not navigate away from the page while this process is ongoing.")),1)]),e("form",{onSubmit:n[2]||(n[2]=h(u=>g(),["prevent"]))},[e("div",L,[i.value?(a(),o("button",G,I)):(a(),o("button",F,s(t.$t("Proceed")),1))])],32)])):l.value==="finish"?(a(),o("div",J,[e("p",K,s(t.$t("Update Successfull!")),1),e("div",O,[e("p",null,s(t.$t("The application has been updated successfully!")),1)]),e("div",Q,[e("div",R,[e("p",X,s(t.$t("Website Url")),1),e("div",Y,[e("div",ee,[m(_(x),{href:"/",class:"underline"},{default:f(()=>[v(s(w.path),1)]),_:1})])])])]),e("div",te,[m(_(x),{href:"/",class:"mt-4 rounded-md bg-primary px-3 py-2 text-sm text-white shadow-sm w-full text-center"},{default:f(()=>[v(s(t.$t("Proceed To Main Site")),1)]),_:1})])])):p("",!0)])])]))}};export{ae as default};
