1import{j as e}from"./query-vendor-DVmmQ-ki.js";import{r as a,L as S}from"./react-vendor-BURXZ51T.js";import{F as B,I as L,L as h,B as U,g as G}from"./index-DpP3iEYK.js";import{C as f,b as j,c as N,d as b,a as E}from"./card-DwBoygcx.js";import{u as t}from"./index-Rp47IaA2.js";import{supabase as v}from"./client-BXzYhP5O.js";import{A}from"./arrow-left-DrlG9OEE.js";import{I as z}from"./image-CMWh5GdR.js";import{U as F}from"./upload-B6QS-LUa.js";import{I as W}from"./info-XAdJRHNr.js";import{C as c}from"./check-Dwauox-g.js";import"./radix-slot-BTvEbTmE.js";import"./supabase-DxfZiqN5.js";function X(){var x;const{data:i,isLoading:y}=B("branding"),w=L(),[n,m]=a.useState(!1),[k,l]=a.useState(!1),r=((x=i==null?void 0:i.find(s=>s.key==="og_image_url"))==null?void 0:x.value)||"/og-image.png",o=a.useCallback(s=>{s.preventDefault(),s.stopPropagation(),s.type==="dragenter"||s.type==="dragover"?l(!0):s.type==="dragleave"&&l(!1)},[]),g=async s=>{if(!s.type.startsWith("image/")){t.error("Bitte nur Bilder hochladen (PNG, JPG, WebP)");return}if(s.size>5*1024*1024){t.error("Datei zu groÃ. Maximal 5MB erlaubt.");return}m(!0);try{const d=s.name.split(".").pop(),u=`og-image-${Date.now()}.${d}`,{error:p}=await v.storage.from("branding").upload(u,s,{upsert:!0});if(p)throw p;const{data:{publicUrl:P}}=v.storage.from("branding").getPublicUrl(u);await w.mutateAsync({key:"og_image_url",value:P}),t.success("OG-Image erfolgreich hochgeladen")}catch(d){console.error("Upload error:",d),t.error("Fehler beim Hochladen")}finally{m(!1)}},C=a.useCallback(s=>{s.preventDefault(),s.stopPropagation(),l(!1),s.dataTransfer.files&&s.dataTransfer.files[0]&&g(s.dataTransfer.files[0])},[]),I=s=>{s.target.files&&s.target.files[0]&&g(s.target.files[0])},D=()=>r.startsWith("http")?r:`${G()}${r}`;return y?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(h,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"min-h-screen",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx(S,{to:"/admin/einstellungen",children:e.jsxs(U,{variant:"ghost",size:"sm",className:"mb-4 -ml-2",children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Zurück zu Einstellungen"]})}),e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Branding"}),e.jsx("p",{className:"text-muted-foreground",children:"Logo, OG-Image und visuelle Identität verwalten."})]}),e.jsxs(f,{className:"mb-8",children:[e.jsxs(j,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-5 w-5"}),"Open Graph Image"]}),e.jsx(b,{children:"Wird bei Social Media Shares (Facebook, LinkedIn, Twitter) angezeigt."})]}),e.jsxs(E,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Aktuelles Bild"}),e.jsx("div",{className:"relative aspect-[1200/630] max-w-2xl border rounded-lg overflow-hidden bg-muted",children:e.jsx("img",{src:r,alt:"OG-Image Preview",className:"w-full h-full object-cover",onError:s=>{s.target.src="/placeholder.svg"}})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["URL: ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:D()})]})]}),e.jsxs("div",{className:` 2 relative border-2 border-dashed rounded-lg p-8 text-center transition-colors 3 ${k?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50"} 4 ${n?"pointer-events-none opacity-50":"cursor-pointer"} 5 `,onDragEnter:o,onDragLeave:o,onDragOver:o,onDrop:C,onClick:()=>{var s;return(s=document.getElementById("og-file-input"))==null?void 0:s.click()},children:[e.jsx("input",{id:"og-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:I,disabled:n}),n?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h,{className:"h-10 w-10 animate-spin text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Wird hochgeladen..."})]}):e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(F,{className:"h-10 w-10 text-muted-foreground"}),e.jsx("p",{className:"text-sm font-medium",children:"Bild hierher ziehen oder klicken zum Auswählen"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG oder WebP, max. 5 MB"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-muted/50 border",children:[e.jsx(W,{className:"h-5 w-5 text-primary mt-0.5 shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium mb-1",children:"Empfohlene MaÃe"}),e.jsxs("ul",{className:"text-muted-foreground space-y-1",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-3 w-3 text-green-500"}),"Auflösung: ",e.jsx("strong",{children:"1200 à 630 Pixel"})]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-3 w-3 text-green-500"}
5),"Seitenverhältnis: ",e.jsx("strong",{children:"1.91:1"})]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-3 w-3 text-green-500"}),"Format: PNG oder JPG"]})]})]})]})]})]}),e.jsx(f,{className:"opacity-60",children:e.jsxs(j,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(N,{children:"Logo"}),e.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Coming Soon"})]}),e.jsx(b,{children:"Logo für Header, Footer und andere Bereiche."})]})})]})}export{X as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.