Files
archy-demo/web-dist/assets/OnboardingBackup-DGLHJlqA.js

2 lines
4.7 KiB
JavaScript

import{d as w,c as s,a as e,D as y,G as b,g,H as _,J as u,r,B,x as C,q as a}from"./index-DnbYEqLr.js";const j={class:"min-h-full flex items-center justify-center p-3 sm:p-4 md:p-6"},D={class:"max-w-[800px] w-full relative z-10 path-glass-container onb-scroll-container"},S={class:"flex flex-col items-center gap-4 sm:gap-6 mb-4 sm:mb-6 px-3 sm:px-4"},V={class:"w-full max-w-[600px] space-y-4 sm:space-y-6"},z={key:0,class:"text-orange-400/80 text-sm"},L={key:1,class:"text-red-400 text-sm"},M={class:"path-option-card cursor-default px-4 py-4 sm:px-6 sm:py-6"},N={class:"text-left w-full"},R={class:"relative"},U=["disabled"],E={key:0},O={key:1,class:"flex items-center justify-center gap-2"},F={key:2,class:"flex items-center justify-center gap-2"},H={key:2,class:"text-center"},T={class:"flex gap-3 sm:gap-4 max-w-[600px] mx-auto flex-shrink-0 px-3 sm:px-4 pb-4 sm:pb-6"},Y=["disabled"],P=w({__name:"OnboardingBackup",setup(I){const m=C(),l=r(""),i=r(!1),c=r(!1),p=r(""),x=r(!1);async function f(){if(l.value){i.value=!0,p.value="";try{const o=await B.createBackup(l.value),t=JSON.stringify(o,null,2),d=new Blob([t],{type:"application/json"}),h=URL.createObjectURL(d),n=document.createElement("a");n.href=h,n.download="archipelago-did-backup.json",n.style.display="none",document.body.appendChild(n),n.click(),setTimeout(()=>{document.body.removeChild(n),URL.revokeObjectURL(h)},1e3),c.value=!0,localStorage.setItem("neode_backup_created","1")}catch(o){const t=o instanceof Error?o.message:String(o);/502|503|504|timeout|fetch|network|Failed to fetch/i.test(t)?x.value=!0:p.value=t||"Failed to create backup. Please try again."}finally{i.value=!1}}}function v(){m.push("/onboarding/verify").catch(()=>{})}function k(){m.push("/onboarding/verify").catch(()=>{})}return(o,t)=>(a(),s("div",j,[e("div",D,[t[7]||(t[7]=e("div",{class:"text-center mb-4 sm:mb-6 flex-shrink-0 px-3 sm:px-4 pt-4 sm:pt-6"},[e("h1",{class:"text-xl sm:text-2xl md:text-[26px] font-semibold text-white/96 mb-2 drop-shadow-[0_2px_6px_rgba(0,0,0,0.4)]"}," Backup Your Identity "),e("p",{class:"text-sm sm:text-base md:text-[20px] text-white/75 leading-relaxed max-w-[600px] mx-auto"}," Create a secure backup of your identity. Set a passphrase and download your encrypted backup file. ")],-1)),e("div",S,[e("div",V,[x.value?(a(),s("p",z,"Server is still starting up. You can try again shortly or skip this step.")):p.value?(a(),s("p",L,y(p.value),1)):b("",!0),e("div",M,[e("div",N,[t[2]||(t[2]=e("label",{class:"block text-xs sm:text-sm font-semibold text-white/80 mb-2 sm:mb-3 uppercase tracking-wide"}," Backup Passphrase ",-1)),e("div",R,[t[1]||(t[1]=e("div",{class:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none"},[e("svg",{class:"w-5 h-5 text-white/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})])],-1)),g(e("input",{"onUpdate:modelValue":t[0]||(t[0]=d=>l.value=d),type:"password",placeholder:"Enter a strong passphrase",class:"w-full bg-black/40 border border-white/10 rounded-lg px-4 py-3 pl-12 text-white/95 placeholder-white/40 focus:outline-none focus:border-white/30 focus:bg-black/50 transition-all"},null,512),[[_,l.value]])]),t[3]||(t[3]=e("p",{class:"text-xs sm:text-sm md:text-base text-white/60 mt-2 sm:mt-3"}," Keep this passphrase safe. You'll need it to restore your identity from backup. ",-1))])]),e("button",{onClick:f,disabled:!l.value||i.value,class:"path-action-button path-action-button--continue w-full"},[!i.value&&!c.value?(a(),s("span",E,"Download Backup")):i.value?(a(),s("span",O,[...t[4]||(t[4]=[e("svg",{class:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1),u(" Downloading... ",-1)])])):(a(),s("span",F,[...t[5]||(t[5]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1),u(" Downloaded ",-1)])]))],8,U),c.value?(a(),s("div",H,[...t[6]||(t[6]=[e("p",{class:"text-sm text-white/70"},[u(" Backup saved as "),e("span",{class:"font-mono text-white/90"},"archipelago-did-backup.json")],-1)])])):b("",!0)])]),e("div",T,[e("button",{onClick:k,class:"path-action-button path-action-button--skip"}," Skip "),e("button",{onClick:v,disabled:!c.value,class:"path-action-button path-action-button--continue disabled:opacity-50"}," Continue ",8,Y)])])]))}});export{P as default};