1import{j as e}from"./query-vendor-DVmmQ-ki.js";import{r,L as be}from"./react-vendor-BURXZ51T.js";import{t as ee,a as ye}from"./image-tools-BjXclwoq.js";import{B as f,L as K}from"./index-DpP3iEYK.js";import{I as W}from"./input-Bx2apBJb.js";import{L as A}from"./label-CiQuxLS0.js";import{S as se}from"./switch-Cp3FZ6fH.js";import{T as we,a as ke,b as q,c as H}from"./tabs-CH4KCsyR.js";import{C as F,b as O,c as $,a as R}from"./card-DwBoygcx.js";import{R as ae,a as re}from"./radio-group-Dnhgh9d-.js";import{C as G}from"./checkbox-CRf3IHWH.js";import{P as _e,a as Ce,b as Se}from"./popover-Dj0yeLTT.js";import{u as v}from"./index-Rp47IaA2.js";import{supabase as D}from"./client-BXzYhP5O.js";import{D as Pe,g as te,a as M,A as ie,b as Le,c as Be}from"./AdCanvas-C59xY68r.js";import{S as Ie}from"./search-gwTUQi-V.js";import{C as De}from"./circle-alert-BGAtDceg.js";import{C as le}from"./car-DDzoQZ-u.js";import{C as Te}from"./crown-D-XLG-jH.js";import{G as Ee}from"./gauge-Becitn9n.js";import{C as ze}from"./clipboard-BZ5WSSUN.js";import{U as Ae}from"./upload-B6QS-LUa.js";import{I as J}from"./image-CMWh5GdR.js";import{X as Z}from"./x-CrVVxRiw.js";import{S as ne}from"./sparkles-BT5dtObF.js";import{C as X}from"./check-Dwauox-g.js";import{A as Fe}from"./arrow-left-DrlG9OEE.js";import{S as Oe}from"./settings-2-CUD1x-Tj.js";import{P as $e}from"./palette-Duc-5q2O.js";import{T as Re}from"./type-_OE4GBKT.js";import{W as Ue}from"./wand-sparkles-k0IJMtFP.js";import{T as Ve}from"./tag-BnYQB_sI.js";import{P as We}from"./plus-B0QqRDRs.js";import{D as ce}from"./download-BqrsYkRJ.js";import{C as Ge}from"./copy-CJmodTUB.js";import"./radix-slot-BTvEbTmE.js";import"./ui-radix-LBOF5AHa.js";import"./circle-BqCuy5sH.js";import"./supabase-DxfZiqN5.js";function qe({onSelect:j,selectedId:a}){const[d,U]=r.useState(""),[S,P]=r.useState(!1),[l,c]=r.useState(null),[T,N]=r.useState(null),[p,o]=r.useState(!1),u=async()=>{if(!d.trim()){N("Bitte Angebotsnummer eingeben");return}P(!0),N(null),c(null),o(!0);try{const h=d.trim(),{data:x}=await D.from("vehicles").select("id, offer_no, make, model_family, model_variant, first_registration, mileage_km, availability, vehicle_condition").eq("offer_no",h).single();if(x){const{data:_}=await D.from("media").select("url").eq("vehicle_id",x.id).eq("is_cover",!0).single(),{data:b}=await D.from("pricing").select("rate_rounded_gross").eq("vehicle_id",x.id).limit(1).maybeSingle(),B={id:x.id,make:x.make,model:x.model_family,model_variant:x.model_variant,image_url:_==null?void 0:_.url,our_rate_gross:(b==null?void 0:b.rate_rounded_gross)||null,first_registration:x.first_registration,mileage_km:x.mileage_km,availability:x.availability,vehicle_condition:x.vehicle_condition,type:"luxury"};c(B),j(B);return}const{data:g}=await D.from("bmw_vehicles").select("id, offer_no, make, model, series, our_rate_gross, image_1_url, first_registration, mileage_km, availability, vehicle_condition").eq("offer_no",h).single();if(g){const _={id:g.id,make:g.make,model:g.model,model_variant:g.series,image_url:g.image_1_url,our_rate_gross:g.our_rate_gross,first_registration:g.first_registration,mileage_km:g.mileage_km,availability:g.availability,vehicle_condition:g.vehicle_condition,type:"bmw"};c(_),j(_);return}N(`Angebotsnummer "${h}" nicht gefunden`)}catch(h){console.error("Search error:",h),N("Suche fehlgeschlagen")}finally{P(!1)}},V=h=>{h.key==="Enter"&&(h.preventDefault(),u())},k=h=>h==="luxury"?e.jsx(Te,{className:"h-3 w-3"}):e.jsx(Ee,{className:"h-3 w-3"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(W,{placeholder:"Angebotsnummer eingeben...",value:d,onChange:h=>U(h.target.value),onKeyDown:V,className:"pl-10"})]}),e.jsx(f,{onClick:u,disabled:S,className:"shrink-0",children:S?e.jsx(K,{className:"h-4 w-4 animate-spin"}):"Suchen"})]}),T&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-destructive/10 text-destructive text-sm",children:[e.jsx(De,{className:"h-4 w-4 shrink-0"}),T]}),l&&e.jsx("div",{className:`group relative overflow-hidden rounded-xl border transition-all ${a===l.id?"border-primary bg-primary/10 ring-2 ring-primary":"border-border bg-card/50"}`,children:e.jsxs("div",{className:"flex gap-4 p-4",children:[e.jsx("div",{className:"w-24 h-16 rounded-lg bg-muted/50 overflow-hidden shrink-0",children:l.image_url?e.jsx("img",{src:l.image_url,alt:`${l.make} ${l.model}`,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(le,{className:"h-6 w-6 text-muted-foreground
1/30"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsxs("div",{className:`px-2 py-0.5 rounded-full text-xs font-medium flex items-center gap-1 ${l.type==="luxury"?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-blue-500/20 text-blue-600 dark:text-blue-400"}`,children:[k(l.type),l.type==="luxury"?"Luxus":"BMW"]})}),e.jsxs("p",{className:"font-medium truncate",children:[l.make," ",l.model]}),l.model_variant&&e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:l.model_variant}),l.our_rate_gross&&e.jsxs("p",{className:"text-sm text-primary mt-0.5",children:["ab ",l.our_rate_gross.toLocaleString("de-DE"),"â¬/mtl."]})]})]})}),!l&&!T&&!p&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(le,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:"Geben Sie eine Angebotsnummer ein"}),e.jsx("p",{className:"text-xs opacity-60 mt-1",children:"z.B. BMW-2025-0042 oder FR-2025-001"})]})]})}function He({onImageReady:j,className:a}){const[d,U]=r.useState(null),[S,P]=r.useState(null),[l,c]=r.useState(!1),[T,N]=r.useState(!1),[p,o]=r.useState({removeBackground:!0,applyPremiumBackground:!0,removeLicensePlate:!0}),u=r.useRef(null),V=r.useRef(null);r.useEffect(()=>{const t=n=>{var L;const y=(L=n.clipboardData)==null?void 0:L.items;if(y){for(const w of y)if(w.type.startsWith("image/")){n.preventDefault();const I=w.getAsFile();I&&k(I);break}}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)},[]);const k=r.useCallback(t=>{const n=new FileReader;n.onload=y=>{var w;const L=(w=y.target)==null?void 0:w.result;U(L),P(null)},n.readAsDataURL(t)},[]),h=t=>{var y;const n=(y=t.target.files)==null?void 0:y[0];n&&n.type.startsWith("image/")&&k(n)},x=r.useCallback(t=>{t.preventDefault(),N(!1);const n=t.dataTransfer.files[0];n&&n.type.startsWith("image/")&&k(n)},[k]),g=t=>{t.preventDefault(),N(!0)},_=()=>{N(!1)},b=async()=>{var t;if(d){c(!0);try{const n=d.split(",")[1],y=d.split(";")[0].split(":")[1],{data:L}=await D.auth.getSession();if(!((t=L==null?void 0:L.session)!=null&&t.access_token)){v.error("Nicht angemeldet");return}const w=await D.functions.invoke("process-vehicle-image",{body:{imageBase64:n,mimeType:y,options:{removeBackground:p.removeBackground,applyPremiumBackground:p.applyPremiumBackground,removeLicensePlate:p.removeLicensePlate}}});if(w.error)throw new Error(w.error.message||"Verarbeitung fehlgeschlagen");const{optimizedUrl:I}=w.data;P(I),j(I,d),v.success("Bild erfolgreich verarbeitet")}catch(n){console.error("Processing error:",n),v.error(n instanceof Error?n.message:"Verarbeitung fehlgeschlagen")}finally{c(!1)}}},B=()=>{d&&(j(d),v.success("Originalbild übernommen"))},E=()=>{U(null),P(null),u.current&&(u.current.value="")};return e.jsxs("div",{className:a,children:[e.jsxs("div",{ref:V,onDrop:x,onDragOver:g,onDragLeave:_,onClick:()=>{var t;return!d&&((t=u.current)==null?void 0:t.click())},className:`relative border-2 border-dashed rounded-xl p-6 transition-all cursor-pointer ${T?"border-primary bg-primary/5":d?"border-border bg-muted/30":"border-border hover:border-primary/50 hover:bg-muted/20"}`,children:[e.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:h,className:"hidden"}),d?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:"Original"}),e.jsx("div",{className:"aspect-video bg-muted rounded-lg overflow-hidden relative",children:e.jsx("img",{src:d,alt:"Original",className:"w-full h-full object-contain"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:l?"Wird verarbeitet...":S?"Verarbeitet":"Vorschau"}),e.jsx("div",{className:"aspect-video bg-muted rounded-lg overflow-hidden relative flex items-center justify-center",children:l?e.jsx(K,{className:"h-8 w-8 animate-spin text-primary"}):S?e.jsx("img",{src:S,alt:"Verarbeitet",className:"w-full h-full object-contain"}
1):e.jsx(J,{className:"h-8 w-8 text-muted-foreground/30"})})]})]}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),E()},className:"absolute top-2 right-2",children:e.jsx(Z,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("div",{className:"mx-auto w-12 h-12 rounded-full bg-muted flex items-center justify-center",children:e.jsx(ze,{className:"h-6 w-6 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Bild einfügen (Ctrl+V)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"oder hierher ziehen / klicken"})]}),e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:t=>{var n;t.stopPropagation(),(n=u.current)==null||n.click()},children:[e.jsx(Ae,{className:"h-4 w-4 mr-2"}),"Datei auswählen"]})]})]}),d&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border bg-card/50 space-y-3",children:[e.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-primary"}),"Photoroom-Verarbeitung"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx(G,{checked:p.removeBackground,onCheckedChange:t=>o({...p,removeBackground:!!t})}),e.jsx("span",{className:"text-sm",children:"Hintergrund entfernen"})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx(G,{checked:p.applyPremiumBackground,onCheckedChange:t=>o({...p,applyPremiumBackground:!!t}),disabled:!p.removeBackground}),e.jsx("span",{className:`text-sm ${p.removeBackground?"":"text-muted-foreground"}`,children:"Premium-Hintergrund anwenden"})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx(G,{checked:p.removeLicensePlate,onCheckedChange:t=>o({...p,removeLicensePlate:!!t})}),e.jsx("span",{className:"text-sm",children:"Kennzeichen schwärzen"})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{onClick:b,disabled:l,className:"flex-1",children:l?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"h-4 w-4 mr-2 animate-spin"}),"Verarbeite..."]}):S?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Erneut verarbeiten"]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-4 w-4 mr-2"}),"Bild verarbeiten"]})}),e.jsx(f,{variant:"outline",onClick:B,disabled:l,children:"Original verwenden"})]})]})]})}function Ds(){const j=r.useRef(null),[a,d]=r.useState(null),[U,S]=r.useState(null),[P,l]=r.useState(null),[c,T]=r.useState("instagram_story"),[N,p]=r.useState("glassmorphism"),[o,u]=r.useState(Pe),[V,k]=r.useState(!1),[h,x]=r.useState(!1),[g,_]=r.useState(!1),[b,B]=r.useState({removeBackground:!0,applyPremiumBackground:!0,removeLicensePlate:!0}),[E,t]=r.useState([]),[n,y]=r.useState(""),[L,w]=r.useState(!1),I=r.useMemo(()=>a?te({first_registration:a.first_registration,mileage_km:a.mileage_km,availability:a.availability,vehicle_condition:a.vehicle_condition}):[],[a]),oe=s=>{t(i=>i.some(m=>m.id===s.id)?i.filter(m=>
1m.id!==s.id):[...i,s])},Q=()=>{if(!n.trim())return;const s={id:`custom-${Date.now()}`,text:n.trim(),type:"custom"};t(i=>[...i,s]),y(""),w(!1)},de=s=>{t(i=>i.filter(m=>m.id!==s))},me=U||P||(a==null?void 0:a.image_url)||void 0,z=a?`${a.make} ${a.model}${a.model_variant?` ${a.model_variant}`:""}`:void 0,ue=a!=null&&a.our_rate_gross?`ab ${a.our_rate_gross.toLocaleString("de-DE")}â¬/mtl.`:o.price,he=s=>{S(s),d(null),l(null)},xe=s=>{d(s),S(null),l(null),s.our_rate_gross&&u(m=>{var C;return{...m,price:`ab ${(C=s.our_rate_gross)==null?void 0:C.toLocaleString("de-DE")}â¬/mtl.`}});const i=te({first_registration:s.first_registration,mileage_km:s.mileage_km,availability:s.availability,vehicle_condition:s.vehicle_condition,our_rate_gross:s.our_rate_gross});t(i)},ge=()=>{d(null),l(null)},pe=async()=>{var s;if(a!=null&&a.image_url){_(!0);try{const{data:i}=await D.auth.getSession();if(!i.session){v.error("Nicht angemeldet");return}const m=await D.functions.invoke("process-vehicle-image",{body:{imageUrl:a.image_url,vehicleId:a.id,options:b,targetFormat:c}});if(m.error)throw new Error(m.error.message||"Verarbeitung fehlgeschlagen");(s=m.data)!=null&&s.optimizedUrl&&(l(m.data.optimizedUrl),v.success("Bild optimiert!"))}catch(i){console.error("Image processing error:",i),v.error("Bildverarbeitung fehlgeschlagen")}finally{_(!1)}}},fe=r.useCallback(async()=>{if(j.current){k(!0);try{const{width:s,height:i}=M(c),m=await ee(j.current,{quality:1,pixelRatio:1,width:s,height:i,style:{transform:"none",transformOrigin:"top left"}}),C=document.createElement("a");C.download=`${z||"ad"}-${c}.png`,C.href=m,C.click(),v.success("PNG heruntergeladen")}catch(s){console.error("Export failed:",s),v.error("Export fehlgeschlagen")}finally{k(!1)}}},[c,z]),je=r.useCallback(async()=>{if(j.current){k(!0);try{const{width:s,height:i}=M(c),m=await ye(j.current,{quality:.95,pixelRatio:1,width:s,height:i,style:{transform:"none",transformOrigin:"top left"}}),C=document.createElement("a");C.download=`${z||"ad"}-${c}.jpg`,C.href=m,C.click(),v.success("JPG heruntergeladen")}catch(s){console.error("Export failed:",s),v.error("Export fehlgeschlagen")}finally{k(!1)}}},[c,z]),ve=r.useCallback(async()=>{if(j.current)try{const{width:s,height:i}=M(c),m=await ee(j.current,{quality:1,pixelRatio:1,width:s,height:i,style:{transform:"none",transformOrigin:"top left"}}),Ne=await(await fetch(m)).blob();await navigator.clipboard.write([new ClipboardItem({"image/png":Ne})]),x(!0),v.success("In Zwischenablage kopiert"),setTimeout(()=>x(!1),2e3)}catch(s){console.error("Copy failed:",s),v.error("Kopieren fehlgeschlagen")}},[c]),Y=ie.find(s=>s.id===c);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(f,{variant:"ghost",size:"icon",asChild:!0,children:e.jsx(be,{to:"/admin/marketing",children:e.jsx(Fe,{className:"h-5 w-5"})})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Ad Creator"}),e.jsx("p",{className:"text-muted-foreground",children:"Erstellen Sie Premium-Werbegrafiken für Social Media"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[1fr_500px] gap-6",children:[e.jsx("div",{className:"space-y-6",children:e.jsxs(we,{defaultValue:"vehicle",className:"w-full",children:[e.jsxs(ke,{className:"w-full grid grid-cols-4",children:[e.jsxs(q,{value:"vehicle",className:"gap-2",children:[e.jsx(J,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Fahrzeug"})]}),e.jsxs(q,{value:"format",className:"gap-2",children:[e.jsx(Oe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Format"})]}),e.jsxs(q,{value:"template",className:"gap-2",children:[e.jsx($e,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Template"})]}),e.jsxs(q,{value:"content",className:"gap-2",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Text"})]})]}),e.jsxs(H,{value:"vehicle",className:"mt-4 space-y-4",children:[e.jsxs(F,{children:[e.jsx(O,{className:"pb-3",children:e.jsx($,{className:"text-lg",children:"Bild hochladen"})}),e.jsx(R,{children:e.jsx(He,{onImageReady:he})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"oder aus Bestand wählen"})})]}),e.jsxs(F,{children:[e.jsx(O,{className:"pb-3",children:e.jsx($,{className:"text-lg",children:"Fahrzeug aus Bestand"})}),e.jsxs(R,{className:"space-y-4",children:[e.jsx(qe,{onSelect:xe,selectedId:a==null?void 0:a.id}),a&&e.jsxs("div",{className:"mt-4 p-4 rounded-xl border bg-muted/30 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[a.image_url&&e.jsx("img",{src:P||a.image_url,alt:z,className:"w-20 h-14 object-cover rounded-lg"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:z}),a.our_rate_gross&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["ab ",a.our_rate_gross.toLocaleStr
1ing("de-DE"),"â¬/mtl."]})]}),e.jsx(f,{variant:"ghost",size:"icon",onClick:ge,className:"shrink-0",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-3 pt-3 border-t",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Bildoptimierung"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(G,{checked:b.removeBackground,onCheckedChange:s=>B(i=>({...i,removeBackground:!!s}))}),e.jsx("span",{className:"text-sm",children:"Hintergrund entfernen"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(G,{checked:b.applyPremiumBackground,onCheckedChange:s=>B(i=>({...i,applyPremiumBackground:!!s})),disabled:!b.removeBackground}),e.jsx("span",{className:`text-sm ${b.removeBackground?"":"text-muted-foreground"}`,children:"Premium-Hintergrund anwenden"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(G,{checked:b.removeLicensePlate,onCheckedChange:s=>B(i=>({...i,removeLicensePlate:!!s}))}),e.jsx("span",{className:"text-sm",children:"Kennzeichen schwärzen"})]})]}),e.jsx(f,{onClick:pe,disabled:g,className:"w-full",size:"sm",children:g?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"h-4 w-4 mr-2 animate-spin"}),"Wird verarbeitet..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ue,{className:"h-4 w-4 mr-2"}),"Bild optimieren"]})}),P&&e.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 text-center",children:"â Optimiertes Bild wird verwendet"})]})]})]})]})]}),e.jsx(H,{value:"format",className:"mt-4",children:e.jsxs(F,{children:[e.jsx(O,{children:e.jsx($,{className:"text-lg",children:"Format wählen"})}),e.jsx(R,{children:e.jsx(ae,{value:c,onValueChange:s=>T(s),children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:ie.map(s=>e.jsxs("label",{className:`flex items-start gap-3 p-4 rounded-xl border cursor-pointer transition-all ${c===s.id?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsx(re,{value:s.id,className:"mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:s.label}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.width," à ",s.height,"px"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.description})]})]},s.id))})})})]})}),e.jsx(H,{value:"template",className:"mt-4",children:e.jsxs(F,{children:[e.jsx(O,{children:e.jsx($,{className:"text-lg",children:"Design Template"})}),e.jsx(R,{children:e.jsx(ae,{value:N,onValueChange:s=>p(s),children:e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Le.map(s=>e.jsxs("label",{className:`relative overflow-hidden rounded-xl border cursor-pointer transition-all ${N===s.id?"border-primary ring-2 ring-primary":"border-border hover:border-primary/50"}`,children:[e.jsx(re,{value:s.id,className:"sr-only"}),e.jsx("div",{className:`aspect-video ${s.previewClass}`,children:e.jsx("div",{className:"absolute inset-0 flex items-end p-3",children:e.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-lg p-2 w-full",children:e.jsx("p",{className:"text-xs text-white font-medium text-center",children:s.label})})})}),e.jsxs("div",{className:"p-3 bg-card",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.id))})})})]})}),e.jsx(H,{value:"content",className:"mt-4",children:e.jsxs(F,{children:[e.jsx(O,{children:e.jsx($,{className:"text-lg",children:"Texte anpassen"})}),e.jsxs(R,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Headline"}),e.jsx(W,{value:o.headline,onChange:s=>u({...o,headline:s.target.value}),placeholder:"Ihr Traumwagen"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Subline"}),e.jsx(W,{value:o.subline,onChange:s=>u({...o,subline:s.target.value}),placeholder:"Premium Leasing ohne Kompromisse"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Preis"}),e.jsx(W,{value:o.price,onChange:s=>u({...o,price:s.target.value}),placeholder:"ab 1.850â¬/mtl."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"CTA (nur bei Deal-Template)"}),e.jsx(W,{value:o.cta,onChange:s=>u({...o,cta:s.target.value}),placeholder:"Jetzt anfragen"})]}),e.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(A,{children:"Labels / Tags"})]}),I.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Aus Fahrzeugdaten"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(s=>e.jsxs(f,{variant:E.some(i=>i.id===s.id)?"default":"outline",size:"sm",onClick:()=>oe(s),className:"h-7 text-xs",children:[s.text,E.some(i=>i.id===s.id)&&e.jsx(X,{className:"h-3 w-3 ml-1"})]},s.id))})]}),E.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Aktiv in Ad"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:E.map(s=>e.jsxs("div",{className:"flex items-center gap-1 bg-primary/10 text-primary rounded-full px-3 py-1",children:[e.jsx("span",{className:"text-xs font-medium",children:s.text}),e.jsx("button",{onClick:()=>de(s.id),className:"hover:bg-primary/20 rounded-full p-0.5",children:e.jsx(Z,{className:"h-3 w-3"})})]},s.id))})]}),e.jsxs(_e,{open:L,onOpenChange:w,children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",className:"h-7 text-xs",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}
1),"Eigenes Label"]})}),e.jsx(Se,{className:"w-64",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"Neues Label"}),e.jsx(W,{placeholder:"z.B. 'Frisch aufbereitet'",value:n,onChange:s=>y(s.target.value),onKeyDown:s=>s.key==="Enter"&&Q()}),e.jsx(f,{onClick:Q,className:"w-full",size:"sm",children:"Hinzufügen"})]})})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("div",{children:[e.jsx(A,{children:"Logo anzeigen"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"LuxuryLeasing Branding"})]}),e.jsx(se,{checked:o.showLogo,onCheckedChange:s=>u({...o,showLogo:s})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(A,{children:"Preis anzeigen"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Monatliche Rate"})]}),e.jsx(se,{checked:o.showPrice,onCheckedChange:s=>u({...o,showPrice:s})})]})]})]})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(F,{children:[e.jsx(O,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx($,{className:"text-lg",children:"Vorschau"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[Y.width," à ",Y.height,"px"]})]})}),e.jsx(R,{children:e.jsx("div",{className:"flex justify-center bg-muted/30 rounded-xl p-4",children:e.jsx(Be,{ref:j,format:c,template:N,content:{...o,price:ue,labels:E},vehicleImage:me,vehicleName:z,containerWidth:c==="instagram_story"?250:400})})})]}),e.jsxs(F,{children:[e.jsx(O,{className:"pb-2",children:e.jsx($,{className:"text-lg",children:"Export"})}),e.jsxs(R,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(f,{onClick:fe,disabled:V,className:"w-full",children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"PNG"]}),e.jsxs(f,{onClick:je,disabled:V,variant:"secondary",className:"w-full",children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"JPG"]})]}),e.jsx(f,{onClick:ve,variant:"outline",className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Kopiert!"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"h-4 w-4 mr-2"}),"In Zwischenablage kopieren"]})})]})]}),!a&&e.jsxs("div",{className:"text-center p-6 border border-dashed rounded-xl",children:[e.jsx(J,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Wählen Sie ein Fahrzeug aus, um die Ad zu gestalten"})]})]})]})]})}export{Ds 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.