-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchunk-BYWB5HG4.js
More file actions
1 lines (1 loc) · 7.92 KB
/
Copy pathchunk-BYWB5HG4.js
File metadata and controls
1 lines (1 loc) · 7.92 KB
1
import{N as $,r as a,j as e,L as D,b as K,aD as P,a2 as R,G as _,X as F,o as M,_ as Y}from"../entries/pages.BZkyDMuN.js";import{S as B}from"./chunk-D8YfSULr.js";import{C as G}from"./chunk-Cb7tTquJ.js";import{B as L}from"./chunk-CxCYcf40.js";import"./chunk-BXl3LOEh.js";/* empty css */import"./chunk-CTVhs4zQ.js";import"./chunk-BassnvpC.js";import"./chunk-DPK_ul2B.js";const O=[{label:"Atbash",value:"atbash"},{label:"Caesar",value:"caesar"},{label:"Vigenère",value:"vigenere"}],te=()=>{const b="Cipher Studio",{addToast:C}=$(),[r,f]=a.useState(""),[d,h]=a.useState(""),[i,k]=a.useState("atbash"),[x,S]=a.useState(3),[g,A]=a.useState("KEY"),[p,j]=a.useState(!0),E=t=>t.replace(/[a-z]/gi,l=>{const o=l.charCodeAt(0),s=o<=90?65:97;return String.fromCharCode(s+(25-(o-s)))}),T=(t,l,o=!1)=>{const s=o?(26-l%26)%26:l%26;return t.replace(/[a-z]/gi,m=>{const n=m.charCodeAt(0),c=n<=90?65:97;return String.fromCharCode(c+(n-c+s)%26)})},z=(t,l,o=!1)=>{let s="",m=0;const n=l.toUpperCase().replace(/[^A-Z]/g,"");if(!n)return t;for(let c=0;c<t.length;c++){const u=t[c];if(u.match(/[a-z]/i)){const w=u.charCodeAt(0),v=w<=90?65:97,N=n.charCodeAt(m%n.length)-65,V=o?(26-N)%26:N;s+=String.fromCharCode(v+(w-v+V)%26),m++}else s+=u}return s},y=a.useCallback(()=>{if(!r){h("");return}let t="";switch(i){case"caesar":t=T(r,x,!p);break;case"vigenere":t=z(r,g,!p);break;default:t=E(r);break}h(t)},[r,i,x,g,p]);a.useEffect(()=>{y()},[y]);const I=()=>{d&&navigator.clipboard.writeText(d).then(()=>{C({title:"Success",message:"Message stored in clipboard."})})};return e.jsxs("div",{className:"min-h-screen bg-[#050505] text-white selection:bg-emerald-500/30 font-sans",children:[e.jsx(B,{title:"Cipher Studio | Fezcodex",description:"Encode and decode messages using classic cryptographic algorithms like Caesar and Vigenère.",keywords:["Fezcodex","cryptography","cipher","encryption","decryption","caesar cipher"]}),e.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 md:px-12",children:[e.jsxs("header",{className:"mb-24",children:[e.jsxs(D,{to:"/apps",className:"group mb-12 inline-flex items-center gap-2 text-xs font-mono text-gray-500 hover:text-white transition-colors uppercase tracking-[0.3em]",children:[e.jsx(K,{weight:"bold",className:"transition-transform group-hover:-translate-x-1"}),e.jsx("span",{children:"Applications"})]}),e.jsx("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-12",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(L,{title:b,slug:"cipher",variant:"brutalist"}),e.jsx("p",{className:"text-xl text-gray-400 max-w-2xl font-light leading-relaxed",children:"Classic message encryption. Choose an algorithm to transform your messages into secure character sequences."})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-12",children:[e.jsxs("div",{className:"lg:col-span-4 space-y-8",children:[e.jsxs("div",{className:"border border-white/10 bg-white/[0.02] p-8 rounded-sm space-y-10",children:[e.jsxs("h3",{className:"font-mono text-[10px] font-bold text-emerald-500 uppercase tracking-widest flex items-center gap-2",children:[e.jsx(P,{weight:"fill"}),"Settings"]}),e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("label",{className:"block font-mono text-[10px] text-gray-500 uppercase tracking-widest",children:"Selected Algorithm"}),e.jsx(G,{variant:"brutalist",options:O,value:i,onChange:k,label:"Choose Cipher"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("button",{onClick:()=>j(!0),className:`flex-1 py-3 border transition-all text-xs font-black uppercase tracking-widest ${p?"bg-white text-black border-white":"border-white/10 text-gray-500 hover:border-white/30"}`,children:"Encode"}),e.jsx("button",{onClick:()=>j(!1),className:`flex-1 py-3 border transition-all text-xs font-black uppercase tracking-widest ${p?"border-white/10 text-gray-500 hover:border-white/30":"bg-white text-black border-white"}`,children:"Decode"})]}),i==="caesar"&&e.jsxs("div",{className:"space-y-4 pt-4 border-t border-white/5",children:[e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsx("label",{className:"font-mono text-[10px] text-gray-500 uppercase",children:"Shift Amount"}),e.jsx("span",{className:"text-xl font-black text-emerald-500",children:x})]}),e.jsx("input",{type:"range",min:"1",max:"25",value:x,onChange:t=>S(parseInt(t.target.value)),className:"w-full accent-emerald-500 h-1 bg-gray-800 rounded-lg appearance-none cursor-pointer"})]}),i==="vigenere"&&e.jsxs("div",{className:"space-y-4 pt-4 border-t border-white/5",children:[e.jsx("label",{className:"block font-mono text-[10px] text-gray-500 uppercase",children:"Secret Key"}),e.jsx("input",{type:"text",value:g,onChange:t=>A(t.target.value.toUpperCase()),placeholder:"Enter word...",className:"w-full bg-black/40 border border-white/10 rounded-sm p-4 font-mono text-sm focus:border-emerald-500/50 focus:ring-0 transition-all uppercase"})]})]})]}),e.jsxs("div",{className:"p-8 border border-white/10 bg-white/[0.01] rounded-sm flex items-start gap-4",children:[e.jsx(R,{size:24,className:"text-gray-700 shrink-0"}),e.jsx("p",{className:"text-[10px] font-mono uppercase tracking-[0.2em] leading-relaxed text-gray-500",children:"These algorithms represent the foundations of cryptography. While visually impactful, they are intended for educational and creative purposes only."})]})]}),e.jsxs("div",{className:"lg:col-span-8 space-y-12",children:[e.jsxs("div",{className:"relative border border-white/10 bg-white/[0.02] p-8 md:p-12 rounded-sm overflow-hidden group",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none grayscale",children:e.jsx(_,{seed:b+r.length+i,className:"w-full h-full"})}),e.jsxs("div",{className:"relative z-10 space-y-12",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"font-mono text-[10px] text-gray-500 uppercase tracking-widest flex items-center gap-2",children:[e.jsx("span",{className:"h-px w-4 bg-gray-800"})," Your Message"]}),e.jsx("textarea",{value:r,onChange:t=>f(t.target.value),placeholder:"Enter your text here...",className:"w-full h-48 p-8 bg-black/40 border border-white/5 rounded-sm font-mono text-sm leading-relaxed focus:border-emerald-500/50 focus:ring-0 transition-all resize-none shadow-inner"})]}),e.jsxs("div",{className:"relative group/output",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("label",{className:"font-mono text-[10px] text-emerald-500 uppercase tracking-widest font-black flex items-center gap-2",children:[e.jsx("span",{className:"h-px w-4 bg-emerald-500/20"})," Result"]}),e.jsx("button",{onClick:I,disabled:!d,className:"text-emerald-500 hover:text-white transition-colors disabled:opacity-0",children:e.jsx(F,{size:24,weight:"bold"})})]}),e.jsx("div",{className:`min-h-[12rem] p-8 border border-emerald-500/20 bg-emerald-500/[0.02] rounded-sm font-mono text-lg md:text-xl break-words transition-colors duration-500 ${d?"text-white":"text-gray-800 italic"}`,children:d||"Waiting for message input..."})]})]})]}),e.jsxs("div",{className:"p-8 border border-white/10 bg-white/[0.01] rounded-sm flex items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(M,{size:32,className:"text-emerald-500/50"}),e.jsx("span",{className:"text-[10px] font-mono text-gray-500 uppercase tracking-widest",children:"Integrity Verified: Processed locally"})]}),e.jsxs("button",{onClick:()=>{f(""),h("")},className:"text-[10px] font-mono uppercase tracking-widest text-gray-600 hover:text-red-500 transition-colors flex items-center gap-2",children:[e.jsx(Y,{weight:"bold"})," Clear Data"]})]})]})]}),e.jsxs("footer",{className:"mt-32 pt-12 border-t border-white/10 flex flex-col md:flex-row justify-between items-center gap-6 text-gray-600 font-mono text-[10px] uppercase tracking-[0.3em]",children:[e.jsx("span",{children:"Fezcodex_Cipher_Studio_v0.6.1"}),e.jsx("span",{className:"text-gray-800",children:"ENCRYPTION // ACTIVE"})]})]})]})};export{te as default};