1import{O as X,a3 as Mt,a4 as Ct,r as d,s as le,N as Y,f as Ne,p as st,d as Me,aU as ya,j as a,P as de,T as Et,c as Tt,e as ue,g as ge,aE as ce,a2 as k,L as ze,b8 as xa,b0 as fa,b1 as wa,b4 as fe,b6 as we,ba,b3 as $e,bh as ja,bg as va,as as Sa,aS as ka,aR as Na,au as Ma,R as qe,bH as At,bI as zt,bJ as Ca,X as Ea,bK as $t,bL as Rt,bM as Ta,bN as Aa,aH as za,az as Ft,A as $a,aD as Ra,al as It,aN as Ye,aO as Xe,aP as Qe,aQ as Je,aw as Fa,aC as Ia,av as Da,a7 as Wa,bO as Pa}from"./index-SUgZbrft.js";import{u as Ha}from"./useGames-Cjd0owLs.js";import{S as Dt}from"./scroll-area-Dnqj0_G2.js";import{U as Ba}from"./upload-CUAksYr9.js";import{c as Wt}from"./index-BdQq_4o_.js";import{S as Ce,a as Ee,b as Te,c as Ae,d as me}from"./select-xiTrP_PM.js";import{T as nt}from"./trash-2-Dm6BwHAx.js";import{E as La}from"./jspdf.es.min-CQC9_-pQ.js";import{S as Va}from"./save-DICkbYJ6.js";import{L as gt}from"./layers-CSYH-azb.js";import"./chevron-up-rbVq_SUK.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const _a=X("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Ua=X("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const Oa=X("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Ga=X("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const Ka=X("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const Za=X("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** 32 * @license lucide-react v0.462.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const qa=X("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 37 * @license lucide-react v0.462.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const Ya=X("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** 42 * @license lucide-react v0.462.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */const Xa=X("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** 47 * @license lucide-react v0.462.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree. 51 */const Qa=X("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** 52 * @license lucide-react v0.462.0 - ISC 53 * 54 * This source code is licensed under the ISC license. 55 * See the LICENSE file in the root directory of this source tree. 56 */const Ja=X("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** 57 * @license lucide-react v0.462.0 - ISC 58 * 59 * This source code is licensed under the ISC license. 60 * See the LICENSE file in the root directory of this source tree. 61 */const ei=X("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** 62 * @license lucide-react v0.462.0 - ISC 63 * 64 * This source code is licensed under the ISC license. 65 * See the LICENSE file in the root directory of this source tree. 66 */const ti=X("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** 67 * @license lucide-react v0.462.0 - ISC 68 * 69 * This source code is licensed under the ISC license. 70 * See the LICENSE file in the root directory of this source tree. 71 */const ai=X("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** 72 * @license lucide-react v0.462.0 - ISC 73 * 74 * This source code is licensed under the ISC license. 75 * See the LICENSE file in the root directory of this source tree. 76 */const ii=X("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),mt=t=>({...t,format:t.format,doc:t.doc});function si(){const{user:t}=Mt(),{activeTeamId:e}
76=Ct(),[i,s]=d.useState([]),[r,l]=d.useState(!0),o=d.useCallback(async()=>{if(!t||!e){s([]),l(!1);return}const{data:u,error:b}=await le.from("media_designs").select("*").eq("team_id",e).order("updated_at",{ascending:!1});b?console.error("Designs laden fehlgeschlagen",b):s(u.map(mt)),l(!1)},[t,e]);d.useEffect(()=>{o()},[o]);const n=d.useCallback(async u=>{if(!t||!e)return Y.error("Kein Team ausgewählt"),null;const{data:b,error:w}=await le.from("media_designs").insert({user_id:t.id,team_id:e,name:u.name,category:u.category??null,is_template:u.isTemplate??!1,format:u.format,doc:u.doc,thumbnail:u.thumbnail??null}).select().single();if(w)return console.error(w),Y.error("Design konnte nicht angelegt werden"),null;const g=mt(b);return s(C=>[g,...C]),g},[t,e]),h=d.useCallback(async(u,b,w={})=>{const{error:g}=await le.from("media_designs").update(b).eq("id",u);return g?(console.error(g),w.silent||Y.error("Speichern fehlgeschlagen"),!1):(s(C=>C.map(E=>E.id===u?{...E,...b,updated_at:new Date().toISOString()}:E)),!0)},[]),m=d.useCallback(async u=>{const{error:b}=await le.from("media_designs").delete().eq("id",u);return b?(Y.error("Löschen fehlgeschlagen"),!1):(s(w=>w.filter(g=>g.id!==u)),Y.success("Design gelöscht"),!0)},[]),j=d.useCallback(async u=>{const b=await n({name:`${u.name} (Kopie)`,format:u.format,doc:u.doc,category:u.category,isTemplate:u.is_template,thumbnail:u.thumbnail});return b&&Y.success("Design duppliziert"),b},[n]),f=d.useCallback(async u=>h(u.id,{is_favorite:!u.is_favorite},{silent:!0}),[h]);return{designs:i,templates:i.filter(u=>u.is_template),projects:i.filter(u=>!u.is_template),isLoading:r,createDesign:n,updateDesign:h,deleteDesign:m,duplicateDesign:j,toggleFavorite:f,refetch:o}}const je={teamName:"Mannschaft",clubName:"Mein Verein",primary:"#0ea5e9",secondary:"#f59e0b",accent:"#ffffff",background:"#0b0f19",logo:null,sponsors:[]};function ni(t){return t?{teamName:t.name||je.teamName,clubName:t.club_name||t.name||je.clubName,primary:t.primary_color||je.primary,secondary:t.secondary_color||je.secondary,accent:"#ffffff",background:"#0b0f19",logo:t.logo_url,sponsors:[t.sponsor1_url,t.sponsor2_url,t.sponsor3_url,t.sponsor4_url].filter(e=>!!e)}:je}const ri=/\{\{([A-Z_]+)\}\}/g;function pt(t,e){return t.replace(ri,(i,s)=>e[s]??i)}function yt(t){const e=Ne(st(t.game_date),"dd.MM.yy",{locale:Me}),i=t.is_home_game?"H":"A",s=t.result_home!==null&&t.result_away!==null?` · ${t.result_home}:${t.result_away}`:"";return`${e} (${i}) ${t.opponent}${s}`}function oi(t){return t.result_home!==null&&t.result_away!==null}function xt(t){const e=new Date,i=[],s=[];for(const r of t){const l=st(r.game_date);l>=e||ya(l,e)?i.push(r):s.push(r)}return{upcoming:i,recent:s.slice().reverse()}}function li(t,e,i){var h;const s=i.slice().sort((m,j)=>(m.number??99)-(j.number??99)).map(m=>m.number?`${m.number} ${m.name}`:m.name),r={TEAM:t.teamName,VEREIN:t.clubName,KADER:s.join(" · "),KADER_LISTE:s.join(` 77`),SPIELER:((h=i[0])==null?void 0:h.name)??"Spieler"};if(!e)return{...r,GEGNER:"Gegner",DATUM:Ne(new Date,"dd.MM.yyyy",{locale:Me}),WOCHENTAG:Ne(new Date,"EEEE",{locale:Me}),UHRZEIT:"15:00",STADION:"Sportplatz",ERGEBNIS:"0:0",WETTBEWERB:"Liga",HEIM:t.teamName,AUSWAERTS:"Gegner",SPIELORT:"Heimspiel"};const l=st(e.game_date),o=e.is_home_game?t.teamName:e.opponent,n=e.is_home_game?e.opponent:t.teamName;return{...r,GEGNER:e.opponent,DATUM:Ne(l,"dd.MM.yyyy",{locale:Me}),WOCHENTAG:Ne(l,"EEEE",{locale:Me}),UHRZEIT:e.game_time?e.game_time.slice(0,5):"â",STADION:e.location||(e.is_home_game?"Heimplatz":e.opponent),ERGEBNIS:oi(e)?`${e.result_home}:${e.result_away}`:"â:â",WETTBEWERB:e.competition||"Liga",HEIM:o,AUSWAERTS:n,SPIELORT:e.is_home_game?"Heimspiel":"Auswärtsspiel"}}const G=(t,e,i,s,r,l)=>({id:t,name:e,width:i,height:s,unit:"px",dpi:72,category:r,platform:l}),pe=(t,e,i,s,r=300)=>({id:t,name:e,width:Math.round(i/25.4*r),height:Math.round(s/25.4*r),unit:"mm",dpi:r,mmWidth:i,mmHeight:s,category:"print",platform:"Print"}),Pt=[G("ig-post","Instagram Beitrag",1080,1080,"social","Instagram"),G("ig-portrait","Instagram Portrait",1080,1350,"social","Instagram"),G("ig-story","Instagram Story",1080,1920,"social","Instagram / Story"),G("tiktok","TikTok",1080,1920,"social","TikTok"),G("fb-post","Facebook Beitrag",1080,1080,"social","Facebook"),G("fb-portrait","Facebook Portrait",1200,1500,"social","Facebook"),G("fb-story","Facebook Story",1080,1920,"social","Facebook"),G("yt-thumb","YouTube Thumbnail",1280,720,"social","YouTube"),G("yt-banner","YouTube Banner",2560,1440,"social","YouTube"),G("wa-status","WhatsApp Status",1080,1920,"social","WhatsApp"),G("x-post","X / Twitter",1600,900,"social","X"),G("x-card","X Card",1200,
77675,"social","X"),G("web","Vereinswebsite",1600,900,"social","Website")],Ht=[pe("a4-p","A4 Hochformat",210,297),pe("a4-l","A4 Querformat",297,210),pe("a5-p","A5 Hochformat",148,210),pe("a5-l","A5 Querformat",210,148),pe("poster-50-70","Poster 50 à 70 cm",500,700,150),pe("poster-70-100","Poster 70 à 100 cm",700,1e3,150),pe("flyer-a6","Flyer A6",105,148)],Bt=[G("matchday","Matchday",1080,1350,"football","Matchday"),G("player-card","Spielerkarte",1080,1350,"football","Spielerkarte"),G("team-poster","Mannschaftsposter",1200,1600,"football","Mannschaft"),G("free","Freies Design",1080,1080,"custom","Frei")],Lt=[...Pt,...Bt,...Ht];function Vt(t){return Lt.find(e=>e.id===t)}const ye=()=>Math.random().toString(36).slice(2,10),ci=()=>({brightness:1,contrast:1,saturate:1,blur:0,grayscale:0}),x=t=>({id:ye(),type:"text",name:t.name||"Text",x:t.x,y:t.y,w:t.w,h:t.h??t.fontSize*1.25,rotation:t.rotation??0,opacity:t.opacity??1,text:t.text,fontFamily:t.fontFamily??"Anton",fontSize:t.fontSize,fontWeight:t.fontWeight??400,align:t.align??"center",lineHeight:t.lineHeight??1.05,letterSpacing:t.letterSpacing??0,color:t.color??"#ffffff",uppercase:t.uppercase??!0,strokeWidth:t.strokeWidth??0,strokeColor:t.strokeColor??"#000000",shadow:t.shadow??null,italic:t.italic,autoFit:t.autoFit??!0}),B=t=>({id:ye(),type:"shape",name:t.name||"Form",x:t.x,y:t.y,w:t.w,h:t.h,rotation:t.rotation??0,opacity:t.opacity??1,shape:t.shape??"rect",fill:t.fill??"#ffffff",gradient:t.gradient??null,borderWidth:t.borderWidth??0,borderColor:t.borderColor??"#ffffff",radius:t.radius??0,shadow:t.shadow??null}),oe=t=>({id:ye(),type:"image",name:t.name||"Bild",x:t.x,y:t.y,w:t.w,h:t.h,rotation:t.rotation??0,opacity:t.opacity??1,src:t.src,fit:t.fit??"contain",mask:t.mask??"none",radius:t.radius??0,filters:t.filters??ci(),borderWidth:t.borderWidth??0,borderColor:t.borderColor??"#ffffff",shadow:t.shadow??null}),ft="rgba(0,0,0,0)",R="#070a12",Ge="#f6f6f4",ve=(t,e,i,s,r="center")=>x({x:t.width*.08,y:e,w:t.width*.84,text:i,fontSize:t.width*.026,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:t.width*.012,color:s,align:r,name:"Kicker"}),q=(t,e,i,s,r=3)=>B({x:t,y:e,w:i,h:r,fill:s,name:"Linie"}),De=(t,e,i,s,r,l,o)=>{const n=t.width*.055;return[B({x:e,y:i,w:s,h:n,shape:"badge",fill:l,name:"Chip"}),x({x:e,y:i+n*.29,w:s,text:r,fontSize:t.width*.026,fontFamily:"Montserrat",fontWeight:700,letterSpacing:t.width*.004,color:o})]},wt=(t,e=.55,i=R)=>B({x:0,y:t.height*(1-e),w:t.width,h:t.height*e,fill:i,gradient:{type:"linear",angle:180,stops:[{color:"rgba(7,10,18,0)",pos:0},{color:i,pos:.75}]},name:"Verlauf unten"}),xe=(t,e,i=.08)=>{const s=t.width*.16,r=[];for(let l=0;l<3;l++)for(let o=0;o<4;o++)r.push(B({x:t.width*.06+o*s*1.6+(l%2?s*.8:0),y:t.height*.02+l*s*1.6,w:s,h:s,rotation:45,fill:e,opacity:i,name:"Muster"}));return r},We=(t,e,i,s,r)=>t.logo?[oe({x:e,y:i,w:s,h:s,src:t.logo,fit:"contain",name:"Logo"})]:[B({x:e,y:i,w:s,h:s,shape:"circle",fill:"rgba(255,255,255,0.08)",borderWidth:Math.max(2,s*.03),borderColor:t.primary,name:"Logo-Platzhalter"}),x({x:e,y:i+s*.36,w:s,text:r,fontSize:s*.28,fontFamily:"Bebas Neue",color:"#ffffff"})],Pe=(t,e,i,s,r,l,o)=>[B({x:e,y:i,w:s,h:r,shape:"roundrect",radius:t.width*.03,fill:"rgba(255,255,255,0.05)",borderWidth:2,borderColor:o.primary,name:"Fotofläche"}),x({x:e+s*.08,y:i+r/2-t.width*.02,w:s*.84,text:l,fontSize:t.width*.025,fontFamily:"Manrope",fontWeight:600,color:"rgba(255,255,255,0.55)",uppercase:!1,name:"Foto-Hinweis"})],ee=(t,e)=>{if(!t.sponsors.length)return[];const i=e.height*.085,s=e.height-i,r=[B({x:0,y:s,w:e.width,h:i,fill:"#ffffff",name:"Sponsorenleiste"}),B({x:0,y:s,w:e.width,h:Math.max(3,e.height*.004),fill:t.primary,name:"Leiste Akzent"})],l=Math.min(4,t.sponsors.length),o=e.width/l;return t.sponsors.slice(0,l).forEach((n,h)=>{r.push(oe({x:h*o+o*.1,y:s+i*.24,w:o*.8,h:i*.58,src:n,fit:"contain",name:`Sponsor ${h+1}`}))}),r},Se=(t,e)=>t.sponsors.length?e.height*.885:e.height*.96,et=[{id:"matchday-cinematic",name:"Matchday · Cinematic",group:"FuÃball",category:"Matchday",style:"cinematic",formatId:"ig-portrait",keywords:["matchday","spieltag","spielankündigung","
77instagram","duell"],build:(t,e)=>{const i=Se(t,e);return{background:{type:"gradient",color:R,gradient:{type:"radial",angle:0,stops:[{color:t.primary,pos:0},{color:R,pos:.9}]}},elements:[...xe(e,"#ffffff",.05),wt(e,.6),ve(e,e.height*.075,"{{WETTBEWERB}} · Spieltag",t.secondary),q(e.width*.44,e.height*.115,e.width*.12,t.secondary),x({x:e.width*.06,y:e.height*.15,w:e.width*.88,h:e.height*.1,text:"{{HEIM}}",fontSize:e.width*.11,fontFamily:"Anton",color:"#ffffff",name:"Heimteam"}),x({x:e.width*.42,y:e.height*.26,w:e.width*.16,text:"vs",fontSize:e.width*.05,fontFamily:"Playfair Display",color:t.secondary,uppercase:!1,italic:!0}),x({x:e.width*.06,y:e.height*.315,w:e.width*.88,h:e.height*.1,text:"{{AUSWAERTS}}",fontSize:e.width*.11,fontFamily:"Anton",color:"#ffffff",name:"Gastteam"}),...We(t,e.width*.36,e.height*.44,e.width*.28,t.teamName.slice(0,3)),q(e.width*.2,i-e.height*.245,e.width*.6,"rgba(255,255,255,0.25)",2),x({x:e.width*.06,y:i-e.height*.215,w:e.width*.88,text:"{{WOCHENTAG}}, {{DATUM}}",fontSize:e.width*.06,fontFamily:"Bebas Neue",color:"#ffffff"}),x({x:e.width*.06,y:i-e.height*.15,w:e.width*.88,text:"{{UHRZEIT}} Uhr · {{STADION}}",fontSize:e.width*.032,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.005,color:"rgba(255,255,255,0.78)"}),...ee(t,e)]}}},{id:"matchday-split",name:"Matchday · Split Duell",group:"FuÃball",category:"Matchday",style:"modern",formatId:"ig-post",keywords:["matchday","modern","spieltag","split"],build:(t,e)=>({background:{type:"color",color:R},elements:[B({x:0,y:0,w:e.width*.52,h:e.height,fill:t.primary,gradient:{type:"linear",angle:160,stops:[{color:t.primary,pos:0},{color:R,pos:1}]},name:"Farbfeld links"}),B({x:e.width*.48,y:-e.height*.1,w:e.width*.08,h:e.height*1.2,fill:R,rotation:8,name:"Diagonale"}),ve(e,e.height*.09,"{{WETTBEWERB}} · Spieltag","#ffffff"),...We(t,e.width*.12,e.height*.23,e.width*.18,t.teamName.slice(0,3)),x({x:e.width*.04,y:e.height*.47,w:e.width*.4,h:e.height*.12,text:"{{HEIM}}",fontSize:e.width*.062,fontFamily:"Archivo Black",color:"#ffffff",name:"Heimteam"}),x({x:e.width*.56,y:e.height*.47,w:e.width*.4,h:e.height*.12,text:"{{AUSWAERTS}}",fontSize:e.width*.062,fontFamily:"Archivo Black",color:"#ffffff",name:"Gastteam"}),B({x:e.width*.43,y:e.height*.34,w:e.width*.14,h:e.width*.14,shape:"circle",fill:t.secondary,name:"Kreis"}),x({x:e.width*.43,y:e.height*.37,w:e.width*.14,text:"vs",fontSize:e.width*.045,fontFamily:"Anton",color:R}),q(e.width*.35,e.height*.66,e.width*.3,t.secondary),x({x:e.width*.06,y:e.height*.71,w:e.width*.88,text:"{{WOCHENTAG}}, {{DATUM}} · {{UHRZEIT}} Uhr",fontSize:e.width*.04,fontFamily:"Bebas Neue",color:"#ffffff"}),x({x:e.width*.06,y:e.height*.775,w:e.width*.88,text:"{{STADION}}",fontSize:e.width*.028,fontFamily:"Manrope",fontWeight:600,letterSpacing:e.width*.004,color:"rgba(255,255,255,0.7)"}),...ee(t,e)]})},{id:"matchday-story",name:"Matchday · Story",group:"FuÃball",category:"Matchday",style:"jugendlich",formatId:"ig-story",keywords:["jugend","story","matchday","whatsapp"],build:(t,e)=>({background:{type:"gradient",color:t.primary,gradient:{type:"linear",angle:165,stops:[{color:t.primary,pos:0},{color:R,pos:.95}]}},elements:[...xe(e,"#ffffff",.06),...We(t,e.width*.38,e.height*.1,e.width*.24,t.teamName.slice(0,3)),...De(e,e.width*.28,e.height*.28,e.width*.44,"{{WETTBEWERB}}",t.secondary,R),x({x:e.width*.08,y:e.height*.37,w:e.width*.84,h:e.height*.08,text:"{{HEIM}}",fontSize:e.width*.1,fontFamily:"Anton",color:"#ffffff",shadow:{x:0,y:6,blur:24,color:"rgba(0,0,0,0.4)"},name:"Heimteam"}),x({x:e.width*.08,y:e.height*.455,w:e.width*.84,text:"gegen",fontSize:e.width*.04,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.01,color:t.secondary}),x({x:e.width*.08,y:e.height*.5,w:e.width*.84,h:e.height*.08,text:"{{AUSWAERTS}}",fontSize:e.width*.09,fontFamily:"Anton",color:"#ffffff",name:"Gastteam"}),B({x:e.width*.1,y:e.height*.63,w:e.width*.8,h:e.height*.13,shape:"roundrect",radius:e.width*.05,fill:"rgba(255,255,255,0.1)",borderWidth:2,borderColor:"rgba(255,255,255,0.25)",name:"Infobox"}),x({x:e.width*.12,y:e.height*.655,w:e.width*.76,text:"{{WOCHENTAG}}, {{DATUM}} · {{UHRZEIT}} Uhr",fontSize:e.width*.042,fontFamily:"Bebas Neue",color:"#ffffff"}),x({x:e.width*.12,y:e.height*.705,w:e.width*.76,text:"{{STADION}}",fontSize:e.width*.028,fontFamily:"Manrope",fontWeight:600,color:"rgba(255,255,255,0.75)"}),...ee(t,e)]})}
77,{id:"matchday-minimal",name:"Matchday · Minimal Hell",group:"FuÃball",category:"Matchday",style:"minimalistisch",formatId:"ig-post",keywords:["minimal","clean","matchday","hell"],build:(t,e)=>({background:{type:"color",color:Ge},elements:[B({x:0,y:0,w:e.width,h:e.height*.02,fill:t.primary,name:"Kopflinie"}),x({x:e.width*.1,y:e.height*.12,w:e.width*.8,text:"{{WETTBEWERB}} · Spieltag",fontSize:e.width*.026,fontFamily:"Manrope",fontWeight:700,letterSpacing:e.width*.012,color:t.primary,align:"left"}),x({x:e.width*.1,y:e.height*.24,w:e.width*.8,h:e.height*.1,text:"{{HEIM}}",fontSize:e.width*.075,fontFamily:"Archivo Black",color:"#111114",align:"left",name:"Heimteam"}),x({x:e.width*.1,y:e.height*.36,w:e.width*.8,h:e.height*.09,text:"{{AUSWAERTS}}",fontSize:e.width*.065,fontFamily:"Archivo Black",color:"#5b5b66",align:"left",name:"Gastteam"}),q(e.width*.1,e.height*.5,e.width*.18,t.secondary,5),x({x:e.width*.1,y:e.height*.57,w:e.width*.8,h:e.height*.18,text:`{{WOCHENTAG}}, {{DATUM}} 78{{UHRZEIT}} Uhr · {{STADION}}`,fontSize:e.width*.034,fontFamily:"Manrope",fontWeight:600,color:"#111114",align:"left",lineHeight:1.5,uppercase:!1}),...t.logo?[oe({x:e.width*.74,y:e.height*.11,w:e.width*.16,h:e.width*.16,src:t.logo,fit:"contain",name:"Logo"})]:[],...ee(t,e)]})},{id:"lineup",name:"Aufstellung · Kaderliste",group:"FuÃball",category:"Aufstellung",style:"modern",formatId:"ig-portrait",keywords:["aufstellung","starting","kader","nominierung","elf"],build:(t,e)=>{const i=Se(t,e);return{background:{type:"gradient",color:R,gradient:{type:"linear",angle:180,stops:[{color:R,pos:0},{color:t.primary,pos:1}]}},elements:[ve(e,e.height*.055,"{{TEAM}} vs {{GEGNER}}",t.secondary),x({x:e.width*.06,y:e.height*.085,w:e.width*.88,text:"Aufstellung",fontSize:e.width*.1,fontFamily:"Anton",color:"#ffffff"}),B({x:e.width*.07,y:e.height*.2,w:e.width*.86,h:i-e.height*.24,shape:"roundrect",radius:e.width*.035,fill:"rgba(7,10,18,0.55)",borderWidth:2,borderColor:"rgba(255,255,255,0.14)",name:"Kaderbox"}),x({x:e.width*.11,y:e.height*.225,w:e.width*.78,h:i-e.height*.29,text:"{{KADER_LISTE}}",fontSize:e.width*.042,fontFamily:"Barlow Condensed",fontWeight:600,color:"#ffffff",align:"left",lineHeight:1.5,name:"Kader"}),x({x:e.width*.06,y:i-e.height*.035,w:e.width*.88,text:"{{DATUM}} · {{UHRZEIT}} Uhr · {{STADION}}",fontSize:e.width*.026,fontFamily:"Manrope",fontWeight:600,color:"rgba(255,255,255,0.7)"}),...ee(t,e)]}}},{id:"final-score",name:"Ergebnis · Endstand",group:"FuÃball",category:"Ergebnis",style:"aggressiv",formatId:"ig-post",keywords:["ergebnis","endstand","score","spielbericht"],build:(t,e)=>({background:{type:"color",color:R},elements:[...xe(e,t.primary,.12),B({x:0,y:e.height*.3,w:e.width,h:e.height*.34,fill:t.primary,opacity:.18,name:"Ergebnisband"}),ve(e,e.height*.1,"Endstand · {{WETTBEWERB}}",t.secondary),x({x:e.width*.06,y:e.height*.16,w:e.width*.88,h:e.height*.09,text:"{{HEIM}} : {{AUSWAERTS}}",fontSize:e.width*.05,fontFamily:"Barlow Condensed",fontWeight:600,color:"rgba(255,255,255,0.85)",name:"Begegnung"}),x({x:e.width*.06,y:e.height*.33,w:e.width*.88,h:e.height*.26,text:"{{ERGEBNIS}}",fontSize:e.width*.24,fontFamily:"Anton",color:"#ffffff",name:"Ergebnis"}),q(e.width*.42,e.height*.63,e.width*.16,t.secondary,6),x({x:e.width*.08,y:e.height*.68,w:e.width*.84,h:e.height*.11,text:"Torschützen: {{SPIELER}}",fontSize:e.width*.033,fontFamily:"Manrope",fontWeight:600,color:"rgba(255,255,255,0.8)",uppercase:!1,lineHeight:1.4,name:"Torschützen"}),x({x:e.width*.08,y:e.height*.8,w:e.width*.84,text:"{{DATUM}} · {{STADION}}",fontSize:e.width*.026,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.005,color:"rgba(255,255,255,0.6)"}),...ee(t,e)]})},{id:"goal",name:"Tor · Torschütze",group:"FuÃball",category:"Torschütze",style:"dynamisch",formatId:"ig-story",keywords:["tor","goal","torschütze","story"],build:(t,e)=>({background:{type:"color",color:R},elements:[B({x:-e.width*.3,y:e.height*.28,w:e.width*1.6,h:e.height*.2,fill:t.primary,rotation:-10,name:"Band"}),x({x:e.width*.06,y:e.height*.3,w:e.width*.88,h:e.height*.14,text:"Tor!",fontSize:e.width*.24,fontFamily:"Anton",color:"#ffffff",rotation:-6}),...De(e,e.width*.3,e.height*.53,e.width*.4,"{{ERGEBNIS}}",t.secondary,R),x({x:e.width*.06,y:e.height*.62,w:e.width*.88,h:e.height*.09,text:"{{SPIELER}}",fontSize:e.width*.095,fontFamily:"Bebas Neue",color:"#ffffff",n
78ame:"Torschütze"}),q(e.width*.42,e.height*.725,e.width*.16,t.primary,5),x({x:e.width*.06,y:e.height*.755,w:e.width*.88,text:"{{TEAM}} vs {{GEGNER}}",fontSize:e.width*.03,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.006,color:"rgba(255,255,255,0.75)"}),...ee(t,e)]})},{id:"player-of-match",name:"Spieler des Spiels",group:"FuÃball",category:"Spieler des Spiels",style:"elegant",formatId:"ig-portrait",keywords:["spieler","mvp","auszeichnung","spieler des spiels"],build:(t,e)=>{const i=Se(t,e);return{background:{type:"gradient",color:R,gradient:{type:"radial",angle:0,stops:[{color:"#1b2432",pos:0},{color:R,pos:1}]}},elements:[ve(e,e.height*.06,"{{TEAM}} · {{WETTBEWERB}}","rgba(255,255,255,0.6)"),...Pe(e,e.width*.2,e.height*.12,e.width*.6,e.width*.6,"Spielerfoto einfügen",t),B({x:e.width*.18,y:e.height*.11,w:e.width*.64,h:e.width*.64,shape:"circle",fill:ft,borderWidth:Math.max(3,e.width*.006),borderColor:t.secondary,name:"Zierring"}),x({x:e.width*.1,y:i-e.height*.26,w:e.width*.8,text:"Spieler des Spiels",fontSize:e.width*.045,fontFamily:"Playfair Display",color:t.secondary,uppercase:!1,italic:!0}),x({x:e.width*.08,y:i-e.height*.2,w:e.width*.84,h:e.height*.1,text:"{{SPIELER}}",fontSize:e.width*.1,fontFamily:"Anton",color:"#ffffff",name:"Name"}),q(e.width*.44,i-e.height*.085,e.width*.12,t.primary,4),x({x:e.width*.08,y:i-e.height*.055,w:e.width*.84,text:"{{TEAM}} vs {{GEGNER}} · {{DATUM}}",fontSize:e.width*.026,fontFamily:"Manrope",fontWeight:600,letterSpacing:e.width*.005,color:"rgba(255,255,255,0.6)"}),...ee(t,e)]}}},{id:"player-card",name:"Spielerkarte",group:"FuÃball",category:"Spielerkarte",style:"cinematic",formatId:"player-card",keywords:["spielerkarte","trading card","profil","spieler"],build:(t,e)=>({background:{type:"gradient",color:R,gradient:{type:"linear",angle:200,stops:[{color:t.primary,pos:0},{color:R,pos:.85}]}},elements:[...xe(e,"#ffffff",.05),...Pe(e,e.width*.1,e.height*.1,e.width*.8,e.height*.5,"Spielerfoto einfügen",t),wt(e,.5),x({x:e.width*.06,y:e.height*.6,w:e.width*.5,text:"#{{NUMMER}}",fontSize:e.width*.14,fontFamily:"Anton",color:t.secondary,align:"left",name:"Nummer"}),x({x:e.width*.06,y:e.height*.74,w:e.width*.88,h:e.height*.09,text:"{{SPIELER}}",fontSize:e.width*.09,fontFamily:"Anton",color:"#ffffff",align:"left",name:"Name"}),q(e.width*.06,e.height*.845,e.width*.2,t.secondary,5),x({x:e.width*.06,y:e.height*.875,w:e.width*.88,text:"{{TEAM}} · {{VEREIN}}",fontSize:e.width*.028,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.006,color:"rgba(255,255,255,0.75)",align:"left"}),...t.logo?[oe({x:e.width*.76,y:e.height*.72,w:e.width*.16,h:e.width*.16,src:t.logo,fit:"contain",name:"Logo"})]:[]]})},{id:"new-player",name:"Neuzugang",group:"FuÃball",category:"Neuzugang",style:"modern",formatId:"ig-post",keywords:["neuzugang","transfer","willkommen"],build:(t,e)=>({background:{type:"color",color:R},elements:[B({x:0,y:0,w:e.width,h:e.height*.2,fill:t.primary,gradient:{type:"linear",angle:90,stops:[{color:t.primary,pos:0},{color:t.secondary,pos:1}]},name:"Kopfband"}),x({x:e.width*.06,y:e.height*.06,w:e.width*.88,text:"Neuzugang",fontSize:e.width*.075,fontFamily:"Archivo Black",color:"#ffffff"}),...Pe(e,e.width*.26,e.height*.27,e.width*.48,e.width*.48,"Foto einfügen",t),x({x:e.width*.06,y:e.height*.71,w:e.width*.88,h:e.height*.1,text:"{{SPIELER}}",fontSize:e.width*.085,fontFamily:"Anton",color:"#ffffff",name:"Name"}),q(e.width*.44,e.height*.815,e.width*.12,t.secondary,4),x({x:e.width*.06,y:e.height*.845,w:e.width*.88,text:"Willkommen bei {{VEREIN}}",fontSize:e.width*.03,fontFamily:"Manrope",fontWeight:600,color:t.secondary,uppercase:!1})]})},{id:"birthday",name:"Geburtstag",group:"Verein",category:"Geburtstagsgrafik",style:"jugendlich",formatId:"ig-post",keywords:["geburtstag","glückwunsch","gratulation"],build:(t,e)=>({background:{type:"gradient",color:t.secondary,gradient:{type:"linear",angle:135,stops:[{color:t.secondary,pos:0},{color:t.primary,pos:1}]}},elements:[B({x:e.width*.07,y:e.height*.1,w:e.width*.86,h:e.height*.8,shape:"roundrect",radius:e.width*.06,fill:"rgba(7,10,18,0.85)",name:"Karte"}),...t.logo?[oe({x:e.width*.42,y:e.height*.15,w:e.width*.16,h:e.width*.16,src:t.logo,fit:"contain",name:"Logo"})]:[],x({x:e.width*.12,y:e.height*.36,w:e.width*.76,text:"Herzlichen Glückwunsch",fontSize:e.width*.045,fontFamily:"Bebas Neue",color:t.secondary}),x({x:e.width*.12,y:e.height*.44,w:e.width*.76,h:e.height*.11,text:"{{SPIELER}}
78",fontSize:e.width*.1,fontFamily:"Anton",color:"#ffffff",name:"Name"}),q(e.width*.44,e.height*.58,e.width*.12,t.primary,4),x({x:e.width*.14,y:e.height*.63,w:e.width*.72,h:e.height*.14,text:"Alles Gute und viel Erfolg â dein Team {{TEAM}}",fontSize:e.width*.034,fontFamily:"Manrope",fontWeight:500,color:"rgba(255,255,255,0.8)",uppercase:!1,lineHeight:1.45})]})},{id:"tournament",name:"Turnier · Plakat A4",group:"FuÃball",category:"Turnier",style:"klassisch",formatId:"a4-p",keywords:["turnier","cup","plakat","poster","print"],build:(t,e)=>({background:{type:"color",color:Ge},elements:[B({x:0,y:0,w:e.width,h:e.height*.3,fill:t.primary,gradient:{type:"linear",angle:160,stops:[{color:t.primary,pos:0},{color:R,pos:1}]},name:"Kopfband"}),...t.logo?[oe({x:e.width*.08,y:e.height*.04,w:e.width*.14,h:e.width*.14,src:t.logo,fit:"contain",name:"Logo"})]:[],x({x:e.width*.08,y:e.height*.19,w:e.width*.84,text:"Turnier",fontSize:e.width*.13,fontFamily:"Anton",color:"#ffffff",align:"left"}),x({x:e.width*.08,y:e.height*.35,w:e.width*.84,h:e.height*.07,text:"{{VEREIN}} lädt ein",fontSize:e.width*.055,fontFamily:"Playfair Display",color:"#14161c",uppercase:!1,align:"left"}),q(e.width*.08,e.height*.44,e.width*.84,t.secondary,4),x({x:e.width*.08,y:e.height*.5,w:e.width*.84,h:e.height*.2,text:`{{DATUM}} 79{{UHRZEIT}} Uhr 80{{STADION}}`,fontSize:e.width*.045,fontFamily:"Barlow Condensed",fontWeight:600,color:"#14161c",lineHeight:1.6,align:"left"}),B({x:e.width*.08,y:e.height*.74,w:e.width*.84,h:e.height*.1,shape:"roundrect",radius:e.width*.02,fill:"rgba(0,0,0,0.05)",name:"Infobox"}),x({x:e.width*.11,y:e.height*.775,w:e.width*.78,text:"Anmeldung & Infos beim Verein",fontSize:e.width*.03,fontFamily:"Manrope",fontWeight:600,color:"#5b5b66",uppercase:!1,align:"left"}),...ee(t,e)]})},{id:"training",name:"Training · Ankündigung",group:"FuÃball",category:"Training",style:"modern",formatId:"wa-status",keywords:["training","ankündigung","whatsapp","einheit"],build:(t,e)=>({background:{type:"gradient",color:R,gradient:{type:"linear",angle:190,stops:[{color:R,pos:0},{color:t.primary,pos:1}]}},elements:[...t.logo?[oe({x:e.width*.08,y:e.height*.08,w:e.width*.18,h:e.width*.18,src:t.logo,fit:"contain",name:"Logo"})]:[],x({x:e.width*.08,y:e.height*.26,w:e.width*.84,text:"Training",fontSize:e.width*.14,fontFamily:"Anton",color:"#ffffff",align:"left"}),x({x:e.width*.08,y:e.height*.36,w:e.width*.84,h:e.height*.06,text:"{{TEAM}}",fontSize:e.width*.055,fontFamily:"Bebas Neue",color:t.secondary,align:"left",name:"Team"}),q(e.width*.08,e.height*.44,e.width*.3,"rgba(255,255,255,0.4)",3),x({x:e.width*.08,y:e.height*.49,w:e.width*.84,h:e.height*.22,text:`{{WOCHENTAG}}, {{DATUM}} 81{{UHRZEIT}} Uhr 82{{STADION}}`,fontSize:e.width*.05,fontFamily:"Barlow Condensed",fontWeight:600,color:"#ffffff",align:"left",lineHeight:1.7}),...De(e,e.width*.08,e.height*.75,e.width*.5,"Bitte pünktlich sein",t.secondary,R),...ee(t,e)]})},{id:"tryout",name:"Probetraining · Spielersuche",group:"Verein",category:"Probetraining",style:"dynamisch",formatId:"ig-portrait",keywords:["probetraining","spielersuche","nachwuchs","mitglied"],build:(t,e)=>{const i=Se(t,e);return{background:{type:"color",color:R},elements:[...xe(e,t.primary,.14),B({x:-e.width*.1,y:e.height*.1,w:e.width*1.2,h:e.height*.22,fill:t.primary,rotation:-4,name:"Band"}),x({x:e.width*.06,y:e.height*.155,w:e.width*.88,h:e.height*.1,text:"Wir suchen dich!",fontSize:e.width*.09,fontFamily:"Anton",color:"#ffffff"}),x({x:e.width*.08,y:e.height*.4,w:e.width*.84,h:e.height*.08,text:"Probetraining bei {{TEAM}}",fontSize:e.width*.05,fontFamily:"Bebas Neue",color:t.secondary,uppercase:!1}),x({x:e.width*.1,y:e.height*.5,w:e.width*.8,h:e.height*.14,text:`{{WOCHENTAG}}, {{DATUM}} · {{UHRZEIT}} Uhr 83{{STADION}}`,fontSize:e.width*.036,fontFamily:"Manrope",fontWeight:600,color:"#ffffff",lineHeight:1.6,uppercase:!1}),...De(e,e.width*.2,i-e.height*.15,e.width*.6,"Einfach vorbeikommen",t.secondary,R),x({x:e.width*.08,y:i-e.height*.06,w:e.width*.84,text:"{{VEREIN}}",fontSize:e.width*.026,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.008,color:"rgba(255,255,255,0.65)"}),...ee(t,e)]}}},{id:"sponsor-thanks",name:"Danke Sponsor",group:"Verein",category:"Sponsoren",style:"elegant",formatId:"ig-post",keywords:["sponsor","danke","partner","unterstützer"],build:(t,e)=>({background:{type:"color",color:Ge},elements:[B({x:0,y:0,w:e.width,h:e.height*.18,fill:t.primary,name:"Kopfband"}),x({x:e.width*.06,y:e.height*.055,w:e.width*.88,text:"Danke, Partner",fontSize:e.width*.06,fontFamily:"Playfair Display",color:"#ffffff",uppercase:!1}),...t.logo?[oe({x:e.width*.42,y:e.height*.24,w:e.width*.16,h:e.width*.16,src:t.logo,fit:"contain",name:"Logo"}
83)]:[],x({x:e.width*.1,y:e.height*.46,w:e.width*.8,h:e.height*.15,text:"Ohne unsere Sponsoren wäre der Vereinsalltag nicht möglich. Danke für die Unterstützung!",fontSize:e.width*.038,fontFamily:"Manrope",fontWeight:500,color:"#14161c",uppercase:!1,lineHeight:1.5}),q(e.width*.42,e.height*.66,e.width*.16,t.secondary,4),x({x:e.width*.1,y:e.height*.71,w:e.width*.8,text:"{{VEREIN}}",fontSize:e.width*.026,fontFamily:"Manrope",fontWeight:700,letterSpacing:e.width*.01,color:"#5b5b66"}),...ee(t,e)]})},{id:"club-announcement",name:"Vereinsnews",group:"Verein",category:"Bekanntmachung",style:"klassisch",formatId:"ig-post",keywords:["news","verein","bekanntmachung","einladung","info"],build:(t,e)=>({background:{type:"color",color:"#101218"},elements:[B({x:e.width*.06,y:e.height*.06,w:e.width*.88,h:e.height*.88,borderWidth:2,borderColor:"rgba(255,255,255,0.22)",fill:ft,name:"Rahmen"}),x({x:e.width*.1,y:e.height*.13,w:e.width*.8,text:"{{VEREIN}}",fontSize:e.width*.028,fontFamily:"Manrope",fontWeight:700,letterSpacing:e.width*.012,color:t.secondary}),x({x:e.width*.1,y:e.height*.3,w:e.width*.8,h:e.height*.11,text:"Vereinsnews",fontSize:e.width*.088,fontFamily:"Anton",color:"#ffffff"}),q(e.width*.44,e.height*.44,e.width*.12,t.primary,4),x({x:e.width*.12,y:e.height*.5,w:e.width*.76,h:e.height*.22,text:"Hier steht deine Nachricht an alle Mitglieder, Eltern und Fans.",fontSize:e.width*.034,fontFamily:"Manrope",fontWeight:500,color:"rgba(255,255,255,0.78)",uppercase:!1,lineHeight:1.5}),x({x:e.width*.1,y:e.height*.8,w:e.width*.8,text:"{{DATUM}}",fontSize:e.width*.026,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.008,color:"rgba(255,255,255,0.5)"})]})},{id:"quote",name:"Zitat",group:"Allgemein",category:"Zitat",style:"minimalistisch",formatId:"ig-post",keywords:["zitat","quote","motivation"],build:(t,e)=>({background:{type:"color",color:"#14161c"},elements:[x({x:e.width*.12,y:e.height*.16,w:e.width*.76,text:"â",fontSize:e.width*.16,fontFamily:"Playfair Display",color:t.secondary,align:"left",uppercase:!1}),x({x:e.width*.12,y:e.height*.3,w:e.width*.76,h:e.height*.28,text:"Erfolg ist die Summe kleiner Anstrengungen, die sich täglich wiederholen.",fontSize:e.width*.055,fontFamily:"Playfair Display",color:"#ffffff",uppercase:!1,lineHeight:1.35,align:"left"}),q(e.width*.12,e.height*.65,e.width*.14,t.secondary,4),x({x:e.width*.12,y:e.height*.7,w:e.width*.76,text:"{{TEAM}}",fontSize:e.width*.026,fontFamily:"Manrope",fontWeight:700,letterSpacing:e.width*.01,color:"rgba(255,255,255,0.6)",align:"left"})]})},{id:"yt-thumb",name:"YouTube Thumbnail",group:"Social Media",category:"YouTube Thumbnail",style:"aggressiv",formatId:"yt-thumb",keywords:["youtube","thumbnail","video","highlights"],build:(t,e)=>({background:{type:"color",color:R},elements:[B({x:0,y:e.height*.6,w:e.width,h:e.height*.4,fill:t.primary,gradient:{type:"linear",angle:90,stops:[{color:t.primary,pos:0},{color:R,pos:1}]},name:"FuÃband"}),x({x:e.width*.04,y:e.height*.1,w:e.width*.7,h:e.height*.4,text:"Highlights",fontSize:e.height*.26,fontFamily:"Anton",color:"#ffffff",align:"left",strokeWidth:8,strokeColor:R}),x({x:e.width*.04,y:e.height*.66,w:e.width*.92,h:e.height*.16,text:"{{HEIM}} {{ERGEBNIS}} {{AUSWAERTS}}",fontSize:e.height*.11,fontFamily:"Bebas Neue",color:"#ffffff",align:"left",name:"Begegnung"}),...t.logo?[oe({x:e.width*.8,y:e.height*.08,w:e.width*.15,h:e.height*.28,src:t.logo,fit:"contain",name:"Logo"})]:[]]})},{id:"team-poster",name:"Mannschaftsposter",group:"FuÃball",category:"Mannschaftsvorstellung",style:"cinematic",formatId:"team-poster",keywords:["mannschaft","poster","kader","saison","teamfoto"],build:(t,e)=>{const i=Se(t,e);return{background:{type:"gradient",color:R,gradient:{type:"linear",angle:180,stops:[{color:R,pos:0},{color:t.primary,pos:.7},{color:R,pos:1}]}},elements:[...xe(e,"#ffffff",.05),...We(t,e.width*.41,e.height*.05,e.width*.18,t.teamName.slice(0,3)),x({x:e.width*.06,y:e.height*.24,w:e.width*.88,h:e.height*.1,text:"{{TEAM}}",fontSize:e.width*.11,fontFamily:"Anton",color:"#ffffff",name:"Team"}),x({x:e.width*.06,y:e.height*.35,w:e.width*.88,text:"Saison {{SAISON}}",fontSize:e.width*.033,fontFamily:"Barlow Condensed",fontWeight:600,letterSpacing:e.width*.01,color:t.secondary}
83),...Pe(e,e.width*.08,e.height*.42,e.width*.84,i-e.height*.5,"Mannschaftsfoto einfügen",t),...ee(t,e)]}}}];function di(t){return{background:{type:"color",color:t.background},elements:[]}}function hi(t,e,i,s=0){const r=o=>Math.max(0,Math.min(o,Math.min(e,i)/2)),l=o=>{const n=r(o);return`M ${n} 0 H ${e-n} Q ${e} 0 ${e} ${n} V ${i-n} Q ${e} ${i} ${e-n} ${i} H ${n} Q 0 ${i} 0 ${i-n} V ${n} Q 0 0 ${n} 0 Z`};switch(t){case"circle":return`M 0 ${i/2} A ${e/2} ${i/2} 0 1 0 ${e} ${i/2} A ${e/2} ${i/2} 0 1 0 0 ${i/2} Z`;case"roundrect":return l(s||Math.min(e,i)*.1);case"badge":return l(i/2);case"triangle":return`M ${e/2} 0 L ${e} ${i} L 0 ${i} Z`;case"line":{const o=Math.max(2,i*.12);return`M 0 ${i/2-o/2} H ${e} V ${i/2+o/2} H 0 Z`}case"arrow":{const o=i*.34;return`M 0 ${i/2-o/2} H ${e*.62} V 0 L ${e} ${i/2} L ${e*.62} ${i} V ${i/2+o/2} H 0 Z`}case"polygon":{const o=[];for(let n=0;n<6;n++){const h=Math.PI*2*n/6-Math.PI/2;o.push(`${e/2+e/2*Math.cos(h)} ${i/2+i/2*Math.sin(h)}`)}return`M ${o.join(" L ")} Z`}case"ring":{const o=e/2-Math.max(4,e*.08),n=i/2-Math.max(4,i*.08);return`M 0 ${i/2} A ${e/2} ${i/2} 0 1 0 ${e} ${i/2} A ${e/2} ${i/2} 0 1 0 0 ${i/2} Z M ${e/2-o} ${i/2} A ${o} ${n} 0 1 1 ${e/2+o} ${i/2} A ${o} ${n} 0 1 1 ${e/2-o} ${i/2} Z`}case"banner":return`M 0 0 H ${e} L ${e-i*.35} ${i/2} L ${e} ${i} H 0 L ${i*.35} ${i/2} Z`;default:return s?l(s):`M 0 0 H ${e} V ${i} H 0 Z`}}function _t(t){const e=[...t.stops].sort((i,s)=>i.pos-s.pos).map(i=>`${i.color} ${Math.round(i.pos*100)}%`).join(", ");return t.type==="radial"?`radial-gradient(circle at 50% 50%, ${e})`:`linear-gradient(${t.angle}deg, ${e})`}function Ke(t,e){switch(t){case"circle":return{borderRadius:"50%"};case"roundrect":return{borderRadius:e||"8%"};case"ring":return{borderRadius:"50%"};case"hexagon":return{clipPath:"polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)"};case"diagonal":return{clipPath:"polygon(0 0, 100% 0, 100% 82%, 0 100%)"};case"shield":return{clipPath:"polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%)"};default:return{}}}function ui(t){return`brightness(${t.brightness}) contrast(${t.contrast}) saturate(${t.saturate}) grayscale(${t.grayscale}) blur(${t.blur}px)`}function gi(t){return new Promise(e=>{if(!t)return e(null);const i=new Image;i.crossOrigin="anonymous",i.onload=()=>e(i),i.onerror=()=>{const s=new Image;s.onload=()=>e(s),s.onerror=()=>e(null),s.src=t},i.src=t})}async function mi(t){const e=new Set;t.background.type==="image"&&t.background.src&&e.add(t.background.src),t.elements.forEach(s=>{s.type==="image"&&s.src&&e.add(s.src)});const i=new Map;return await Promise.all([...e].map(async s=>{const r=await gi(s);r&&i.set(s,r)})),i}function Ut(t,e,i,s,r,l){let o;if(e.type==="radial")o=t.createRadialGradient(i+r/2,s+l/2,0,i+r/2,s+l/2,Math.max(r,l)/2);else{const h=(e.angle-90)*Math.PI/180,m=i+r/2,j=s+l/2,f=(Math.abs(r*Math.cos(h))+Math.abs(l*Math.sin(h)))/2;o=t.createLinearGradient(m-Math.cos(h)*f,j-Math.sin(h)*f,m+Math.cos(h)*f,j+Math.sin(h)*f)}return[...e.stops].sort((h,m)=>h.pos-m.pos).forEach(h=>o.addColorStop(Math.min(1,Math.max(0,h.pos)),h.color)),o}function He(t,e,i,s,r,l){const o=Math.max(0,Math.min(l,Math.min(s,r)/2));t.beginPath(),t.moveTo(e+o,i),t.lineTo(e+s-o,i),t.quadraticCurveTo(e+s,i,e+s,i+o),t.lineTo(e+s,i+r-o),t.quadraticCurveTo(e+s,i+r,e+s-o,i+r),t.lineTo(e+o,i+r),t.quadraticCurveTo(e,i+r,e,i+r-o),t.lineTo(e,i+o),t.quadraticCurveTo(e,i,e+o,i),t.closePath()}function Ot(t,e,i,s,r){switch(e){case"circle":t.beginPath(),t.ellipse(i/2,s/2,i/2,s/2,0,0,Math.PI*2),t.closePath();break;case"roundrect":He(t,0,0,i,s,r||Math.min(i,s)*.1);break;case"triangle":t.beginPath(),t.moveTo(i/2,0),t.lineTo(i,s),t.lineTo(0,s),t.closePath();break;case"line":t.beginPath(),t.rect(0,s/2-Math.max(1,s*.06),i,Math.max(2,s*.12)),t.closePath();break;case"arrow":{const l=s*.34;t.beginPath(),t.moveTo(0,s/2-l/2),t.lineTo(i*.62,s/2-l/2),t.lineTo(i*.62,0),t.lineTo(i,s/2),t.lineTo(i*.62,s),t.lineTo(i*.62,s/2+l/2),t.lineTo(0,s/2+l/2),t.closePath();break}case"polygon":{t.beginPath();const l=6;for(let o=0;o<l;o++){const n=Math.PI*2*o/l-Math.PI/2,h=i/2+i/2*Math.cos(n),m=s/2+s/2*Math.sin(n);o===0?t.moveTo(h,m):t.lineTo(h,m)}t.closePath();break}case"ring":t.beginPath(),t.ellipse(i/2,s/2,i/2,s/2,0,0,Math.PI*2),t.ellipse(i/2,s/2,i/2-Math.max(4,i*.08),s/2-Math.max(4,s*.08),0,0,Math.PI*2,!0),t.closePath();break;case"badge":He(t,0,0,i,s,s/2);break;case"banner":t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i-s*.35,s/2),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(s*.35,s/2),t.closePath();break;default:He(t,0,0,i,s,r)}}function bt(t,e,i,s,r){switch(e){case"circle":t.beginPath(),t.ellipse(i/2,s/2,i/2,s/2,0,0,Math.PI*2),t.closePath();break;case"roundrect":He(t,0,0,i,s,r||Math.min(i,s)*.12);break;case"ring":t.beginPath(),t.ellipse(i/2,s/2,i/2,s/2,0,0,Math.PI*2),t.closePath();break;
83case"hexagon":Ot(t,"polygon",i,s,0);break;case"diagonal":t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s*.82),t.lineTo(0,s),t.closePath();break;case"shield":t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s*.55),t.quadraticCurveTo(i,s*.9,i/2,s),t.quadraticCurveTo(0,s*.9,0,s*.55),t.closePath();break;default:t.beginPath(),t.rect(0,0,i,s),t.closePath()}}function rt(t,e){e&&(t.shadowOffsetX=e.x,t.shadowOffsetY=e.y,t.shadowBlur=e.blur,t.shadowColor=e.color)}function Be(t){t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,t.shadowColor="transparent"}function Gt(t,e,i){const s=[];return e.split(` 84`).forEach(r=>{const l=r.split(" ");let o="";l.forEach(n=>{const h=o?`${o} ${n}`:n;t.measureText(h).width>i&&o?(s.push(o),o=n):o=h}),s.push(o)}),s}const Kt=(t,e)=>`${t.italic?"italic ":""}${t.fontWeight} ${e}px "${t.fontFamily}", sans-serif`;function Zt(t,e){if(!t.autoFit)return t.fontSize;const i=e??document.createElement("canvas").getContext("2d");if(!i)return t.fontSize;const s=t.uppercase?t.text.toUpperCase():t.text,r=Math.max(t.fontSize*t.lineHeight,t.h);let l=t.fontSize;const o=Math.max(8,t.fontSize*.35);for(let n=0;n<40&&l>o;n++){i.font=Kt(t,l);const h=Gt(i,s,t.w),m=Math.max(...h.map(f=>i.measureText(f).width)),j=h.length*l*t.lineHeight;if(m<=t.w&&j<=r)break;l*=.94}return Math.round(l)}function pi(t,e){const i=e.uppercase?e.text.toUpperCase():e.text,s=Zt(e,t);t.font=Kt(e,s);try{t.letterSpacing=`${e.letterSpacing}px`}catch{}t.textBaseline="top",t.textAlign=e.align==="center"?"center":e.align==="right"?"right":"left";const r=Gt(t,i,e.w),l=s*e.lineHeight,o=e.align==="center"?e.w/2:e.align==="right"?e.w:0;r.forEach((n,h)=>{const m=h*l;e.strokeWidth&&e.strokeWidth>0&&(t.lineWidth=e.strokeWidth,t.strokeStyle=e.strokeColor||"#000000",t.lineJoin="round",t.strokeText(n,o,m)),rt(t,e.shadow),t.fillStyle=e.color,t.fillText(n,o,m),Be(t)});try{t.letterSpacing="0px"}catch{}}function yi(t,e,i){const s=i.get(e.src);if(rt(t,e.shadow),t.save(),bt(t,e.mask,e.w,e.h,e.radius),!s){t.fillStyle="rgba(255,255,255,0.08)",t.fill(),t.restore(),Be(t);return}t.fill(),Be(t),t.clip();const r=e.filters;t.filter=`brightness(${r.brightness}) contrast(${r.contrast}) saturate(${r.saturate}) grayscale(${r.grayscale}) blur(${r.blur}px)`;const l=s.width/s.height,o=e.w/e.h;let n=e.w,h=e.h;(e.fit==="cover"?l>o:l<o)?(h=e.h,n=h*l):(n=e.w,h=n/l),t.drawImage(s,(e.w-n)/2,(e.h-h)/2,n,h),t.filter="none",t.restore(),e.borderWidth>0&&(t.save(),bt(t,e.mask,e.w,e.h,e.radius),t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,t.stroke(),t.restore())}function xi(t,e){t.save(),Ot(t,e.shape,e.w,e.h,e.radius),rt(t,e.shadow),t.fillStyle=e.gradient?Ut(t,e.gradient,0,0,e.w,e.h):e.fill,t.fill(e.shape==="ring"?"evenodd":"nonzero"),Be(t),e.borderWidth>0&&(t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,t.stroke()),t.restore()}function fi(t,e,i){e.hidden||(t.save(),t.globalAlpha=e.opacity,t.translate(e.x+e.w/2,e.y+e.h/2),e.rotation&&t.rotate(e.rotation*Math.PI/180),t.translate(-e.w/2,-e.h/2),e.type==="text"?pi(t,e):e.type==="image"?yi(t,e,i):xi(t,e),t.restore())}function wi(t,e,i,s){const{width:r,height:l}=i,o=e.background;if(t.fillStyle=o.color||"#0b0f19",t.fillRect(0,0,r,l),o.type==="gradient"&&o.gradient&&(t.fillStyle=Ut(t,o.gradient,0,0,r,l),t.fillRect(0,0,r,l)),o.type==="image"&&o.src){const n=s.get(o.src);if(n){const h=n.width/n.height,m=r/l;let j=r,f=l;h>m?(f=l,j=f*h):(j=r,f=j/h),t.drawImage(n,(r-j)/2,(l-f)/2,j,f)}o.overlay&&o.overlay>0&&(t.fillStyle=o.overlayColor||"#000000",t.globalAlpha=o.overlay,t.fillRect(0,0,r,l),t.globalAlpha=1)}}async function ot(t,e,i=1){var o;const s=await mi(t);if((o=document.fonts)!=null&&o.ready)try{await document.fonts.ready}catch{}const r=document.createElement("canvas");r.width=Math.round(e.width*i),r.height=Math.round(e.height*i);const l=r.getContext("2d");return l&&(l.scale(i,i),wi(l,t,e,s),t.elements.forEach(n=>fi(l,n,s))),r}const Ze=t=>t?`${t.x}px ${t.y}px ${t.blur}px ${t.color}`:void 0,bi=d.memo(function({background:e,width:i,height:s}){return a.jsxs("div",{className:"absolute inset-0",style:{background:e.color},children:[e.type==="gradient"&&e.gradient&&a.jsx("div",{className:"absolute inset-0",style:{background:_t(e.gradient)}}),e.type==="image"&&e.src&&a.jsxs(a.Fragment,{children:[a.jsx("img",{src:e.src,alt:"",draggable:!1,style:{position:"absolute",inset:0,width:i,height:s,objectFit:e.fit==="contain"?"contain":"cover"}}),!!e.overlay&&a.jsx("div",{className:"absolute inset-0",style:{background:e.overlayColor||"#000",opacity:e.overlay}})]})]})}),ji=d.memo(function({el:e}){const i={position:"absolute",left:e.x,top:e.y,width:e.w,height:e.h,opacity:e.opacity,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,pointerEvents:"none"};if(e.hidden)return null;if(e.type==="text")return a.jsx("div",{style:{...i,height:"auto",minHeight:e.h,fontFamily:`"${e.fontFamily}", sans-serif`,fontSize:Zt(e),fontWeight:e.fontWeight,fontStyle:e.italic?"italic":void 0,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,color:e.color,textAlign:e.align,textTransform:e.uppercase?"uppercase":"none",whiteSpace:"pre-wrap",overflowWrap:"break-word",textShadow:Ze(e.shadow),WebkitTextStrokeWidth:e.strokeWidth?e.strokeWidth:void 0,WebkitTextStrokeColor:e.strokeWidth?e.strokeColor:void 0,paintOrder:"stroke fill"},children:e.text});
84if(e.type==="image")return a.jsxs("div",{style:{...i,boxShadow:Ze(e.shadow),...Ke(e.mask,e.radius)},children:[a.jsx("img",{src:e.src,alt:e.name||"Bild",draggable:!1,style:{width:"100%",height:"100%",objectFit:e.fit,filter:ui(e.filters),...Ke(e.mask,e.radius)}}),e.borderWidth>0&&a.jsx("div",{className:"absolute inset-0",style:{border:`${e.borderWidth}px solid ${e.borderColor}`,...Ke(e.mask,e.radius)}})]});const s=`grad-${e.id}`;return a.jsx("div",{style:i,children:a.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${e.w} ${e.h}`,preserveAspectRatio:"none",style:{overflow:"visible",filter:e.shadow?`drop-shadow(${Ze(e.shadow)})`:void 0},children:[e.gradient&&a.jsx("defs",{children:e.gradient.type==="linear"?a.jsx("linearGradient",{id:s,gradientTransform:`rotate(${e.gradient.angle-90} 0.5 0.5)`,children:e.gradient.stops.map((r,l)=>a.jsx("stop",{offset:`${r.pos*100}%`,stopColor:r.color},l))}):a.jsx("radialGradient",{id:s,children:e.gradient.stops.map((r,l)=>a.jsx("stop",{offset:`${r.pos*100}%`,stopColor:r.color},l))})}),a.jsx("path",{d:hi(e.shape,e.w,e.h,e.radius),fill:e.gradient?`url(#${s})`:e.fill,fillRule:e.shape==="ring"?"evenodd":"nonzero",stroke:e.borderWidth>0?e.borderColor:"none",strokeWidth:e.borderWidth})]})})}),vi=8;function Si({doc:t,format:e,selectedId:i,zoom:s,onSelect:r,onUpdateElement:l,onFitScale:o}){const n=d.useRef(null),[h,m]=d.useState(.25),[j,f]=d.useState(null),[u,b]=d.useState({v:[],h:[]}),w=h*s;d.useLayoutEffect(()=>{const p=()=>{const D=n.current;if(!D)return;const I=48,O=Math.min((D.clientWidth-I)/e.width,(D.clientHeight-I)/e.height),T=Math.max(.02,O);m(T),o==null||o(T)};p();const $=new ResizeObserver(p);return n.current&&$.observe(n.current),()=>$.disconnect()},[e.width,e.height,o]);const g=t.elements.find(p=>p.id===i)||null,C=d.useCallback((p,$)=>{const D=vi/w;for(const I of $)if(Math.abs(p-I)<D)return I;return null},[w]),E=(p,$,D,I)=>{var O,T;D.locked||(p.stopPropagation(),(T=(O=p.target).setPointerCapture)==null||T.call(O,p.pointerId),f({mode:$,handle:I,startX:p.clientX,startY:p.clientY,el:{...D}}))};d.useEffect(()=>{if(!j)return;const p=t.elements.filter(T=>T.id!==j.el.id&&!T.hidden),$=[e.width/2,0,e.width,...p.flatMap(T=>[T.x,T.x+T.w/2,T.x+T.w])],D=[e.height/2,0,e.height,...p.flatMap(T=>[T.y,T.y+T.h/2,T.y+T.h])],I=T=>{const K=(T.clientX-j.startX)/w,W=(T.clientY-j.startY)/w,N=j.el;if(j.mode==="move"){let F=N.x+K,P=N.y+W;const _=[],ne=[],ae=C(F,$)!==null?{edge:"left",at:C(F,$)}:C(F+N.w/2,$)!==null?{edge:"center",at:C(F+N.w/2,$)}:C(F+N.w,$)!==null?{edge:"right",at:C(F+N.w,$)}:null;ae&&(F=ae.edge==="left"?ae.at:ae.edge==="center"?ae.at-N.w/2:ae.at-N.w,_.push(ae.at));const J=C(P,D)!==null?{edge:"top",at:C(P,D)}:C(P+N.h/2,D)!==null?{edge:"middle",at:C(P+N.h/2,D)}:C(P+N.h,D)!==null?{edge:"bottom",at:C(P+N.h,D)}:null;J&&(P=J.edge==="top"?J.at:J.edge==="middle"?J.at-N.h/2:J.at-N.h,ne.push(J.at)),b({v:_,h:ne}),l(N.id,{x:Math.round(F),y:Math.round(P)},!1);return}if(j.mode==="rotate"){const F=Math.atan2(T.clientY-j.startY,T.clientX-j.startX)*180/Math.PI+90,P=Math.abs(F%15)<4?Math.round(F/15)*15:F;l(N.id,{rotation:Math.round(P)},!1);return}const Z=j.handle;let{x:te,y:v,w:M,hh:L}={x:N.x,y:N.y,w:N.w,hh:N.h};Z.includes("e")&&(M=N.w+K),Z.includes("s")&&(L=N.h+W),Z.includes("w")&&(M=N.w-K,te=N.x+K),Z.includes("n")&&(L=N.h-W,v=N.y+W);const U=16;M<U&&(M=U),L<U&&(L=U);const re={x:Math.round(te),y:Math.round(v),w:Math.round(M),h:Math.round(L)};if(N.type==="text"&&Z.length===2){const F=L/N.h;re.fontSize=Math.max(8,Math.round(N.fontSize*F))}l(N.id,re,!1)},O=()=>{b({v:[],h:[]}),l(j.el.id,{},!0),f(null)};return window.addEventListener("pointermove",I),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O),()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O)}},[j,w,t.elements,e.width,e.height,l,C]);const c=12/w,z=g?[{id:"nw",cx:0,cy:0,cursor:"nwse-resize"},{id:"n",cx:g.w/2,cy:0,cursor:"ns-resize"},{id:"ne",cx:g.w,cy:0,cursor:"nesw-resize"},{id:"e",cx:g.w,cy:g.h/2,cursor:"ew-resize"},{id:"se",cx:g.w,cy:g.h,cursor:"nwse-resize"},{id:"s",cx:g.w/2,cy:g.h,cursor:"ns-resize"},{id:"sw",cx:0,cy:g.h,cursor:"nesw-resize"}
84,{id:"w",cx:0,cy:g.h/2,cursor:"ew-resize"}]:[];return a.jsxs("div",{ref:n,className:"relative flex-1 min-h-0 overflow-auto bg-muted/20 flex items-center justify-center p-6",onPointerDown:()=>r(null),children:[a.jsx("div",{className:"relative shadow-2xl shrink-0",style:{width:e.width*w,height:e.height*w},children:a.jsxs("div",{className:"absolute top-0 left-0 origin-top-left overflow-hidden",style:{width:e.width,height:e.height,transform:`scale(${w})`},children:[a.jsx(bi,{background:t.background,width:e.width,height:e.height}),t.elements.map(p=>a.jsx("div",{className:"absolute inset-0",children:a.jsx(ji,{el:p})},p.id)),t.elements.map(p=>p.hidden?null:a.jsx("div",{onPointerDown:$=>{$.stopPropagation(),r(p.id),E($,"move",p)},style:{position:"absolute",left:p.x,top:p.y,width:p.w,height:p.h,transform:p.rotation?`rotate(${p.rotation}deg)`:void 0,cursor:p.locked?"not-allowed":"move",touchAction:"none"}},`hit-${p.id}`)),u.v.map(p=>a.jsx("div",{className:"absolute bg-primary",style:{left:p,top:0,width:1/w,height:e.height}},`v${p}`)),u.h.map(p=>a.jsx("div",{className:"absolute bg-primary",style:{top:p,left:0,height:1/w,width:e.width}},`h${p}`)),g&&a.jsx("div",{className:"absolute",style:{left:g.x,top:g.y,width:g.w,height:g.h,transform:g.rotation?`rotate(${g.rotation}deg)`:void 0,outline:`${1.5/w}px solid hsl(var(--primary))`,pointerEvents:"none"},children:!g.locked&&a.jsxs(a.Fragment,{children:[z.map(p=>a.jsx("div",{onPointerDown:$=>E($,"resize",g,p.id),className:"absolute bg-background border border-primary",style:{left:p.cx-c/2,top:p.cy-c/2,width:c,height:c,borderRadius:c/4,borderWidth:1/w,cursor:p.cursor,pointerEvents:"auto",touchAction:"none"}},p.id)),a.jsx("div",{onPointerDown:p=>E(p,"rotate",g,"rot"),className:"absolute bg-primary rounded-full",style:{left:g.w/2-c/2,top:-c*2.5,width:c,height:c,cursor:"grab",pointerEvents:"auto",touchAction:"none"}})]})})]})}),a.jsxs("div",{className:de("absolute bottom-2 right-3 text-[10px] text-muted-foreground/70 pointer-events-none"),children:[e.width," à ",e.height," px · ",Math.round(w*100)," %"]})]})}const lt=[{family:"Anton",label:"Anton",category:"Sport"},{family:"Bebas Neue",label:"Bebas Neue",category:"Sport"},{family:"Teko",label:"Teko",category:"Sport"},{family:"Archivo Black",label:"Archivo Black",category:"Bold"},{family:"Barlow Condensed",label:"Barlow Condensed",category:"Condensed"},{family:"Oswald",label:"Oswald",category:"Condensed"},{family:"Montserrat",label:"Montserrat",category:"Modern"},{family:"Space Grotesk",label:"Space Grotesk",category:"Modern"},{family:"Manrope",label:"Manrope",category:"Minimal"},{family:"Inter",label:"Inter",category:"Minimal"},{family:"Rubik",label:"Rubik",category:"Jugendlich"},{family:"Playfair Display",label:"Playfair Display",category:"Elegant"}];[...new Set(lt.map(t=>t.category))];const ke="team-assets",ki=["image/jpeg","image/jpg","image/png","image/webp","image/gif","image/svg+xml"],Ni=[".jpg",".jpeg",".png",".webp",".gif",".svg"],jt=5;function Mi(){const{user:t}=Mt(),[e,i]=d.useState([]),[s,r]=d.useState(!0),[l,o]=d.useState(!1),n=t?`${t.id}/media`:null,h=d.useCallback(async()=>{if(!n){i([]),r(!1);return}const{data:u,error:b}=await le.storage.from(ke).list(n,{limit:200,sortBy:{column:"created_at",order:"desc"}});b?console.error("Medien laden fehlgeschlagen",b):i((u||[]).filter(w=>w.name&&!w.name.startsWith(".")).map(w=>{const g=`${n}/${w.name}`;return{name:w.name,path:g,url:le.storage.from(ke).getPublicUrl(g).data.publicUrl,updatedAt:w.updated_at||w.created_at||""}})),r(!1)},[n]);d.useEffect(()=>{h()},[h]);const m=d.useCallback(async u=>{var w;if(!n)return Y.error("Bitte melde dich an"),null;const b="."+(((w=u.name.split(".").pop())==null?void 0:w.toLowerCase())||"");if(!ki.includes(u.type.toLowerCase())&&!Ni.includes(b))return Y.error("Nur JPG, PNG, WebP, GIF oder SVG möglich"),null;if(u.size>jt*1024*1024)return Y.error(`Datei zu groà (max. ${jt} MB)`),null;o(!0);try{const g=`${n}/${Date.now()}-${u.name.replace(/[^\w.\-]/g,"_")}`,{error:C}=await le.storage.from(ke).upload(g,u,{upsert:!0});if(C)throw C;const E={name:u.name,path:g,url:le.storage.from(ke).getPublicUrl(g).data.publicUrl,updatedAt:new Date().toISOString()};return i(c=>[E,...c]),E}catch(g){return console.error(g),Y.error("Upload fehlgeschlagen"),null}finally{o(!1)}},[n]),j=d.useCallback(async u=>{const{error:b}=await le.storage.from(ke).remove([u.path]);if(b){Y.error("Löschen fehlgeschlagen");return}i(w=>w.filter(g=>g.path!==u.path))},[]),f=d.useCallback(async(u,b)=>{const w=await(await fetch(u)).blob(),g=new File([w],b,{type:w.type||"image/png"});return m(g)},[m]);return{assets:e,isLoading:s,isUploading:l,upload:m,uploadDataUrl:f,remove:j,refetch:h}}function Ci({template:t,brand:e,className:i,width:s=200}
84){const[r,l]=d.useState(null),[o,n]=d.useState(1),h=d.useRef(!0);return d.useEffect(()=>{h.current=!0;const m=Vt(t.formatId);if(!m)return;n(m.width/m.height);const j=s/m.width;return ot(t.build(e,m),m,j).then(f=>{h.current&&l(f.toDataURL("image/png"))}).catch(()=>{}),()=>{h.current=!1}},[t,e,s]),a.jsx("div",{className:de("w-full overflow-hidden rounded-lg bg-muted/40",i),style:{aspectRatio:String(o)},children:r&&a.jsx("img",{src:r,alt:t.name,className:"h-full w-full object-cover",loading:"lazy"})})}const Ei=[{kind:"rect",label:"Rechteck"},{kind:"roundrect",label:"Abgerundet"},{kind:"circle",label:"Kreis"},{kind:"triangle",label:"Dreieck"},{kind:"line",label:"Linie"},{kind:"arrow",label:"Pfeil"},{kind:"polygon",label:"Polygon"},{kind:"ring",label:"Kreisring"},{kind:"badge",label:"Badge"},{kind:"banner",label:"Banner"}];function vt({brand:t,players:e,format:i,onAddElement:s,onApplyTemplate:r,onSetBackground:l}){const[o,n]=d.useState(""),{assets:h,upload:m,isUploading:j}=Mi(),f=d.useRef(null),u=et.filter(c=>`${c.name} ${c.category} ${c.style} ${c.keywords.join(" ")}`.toLowerCase().includes(o.toLowerCase())),b=c=>{const z={head:i.width*.09,sub:i.width*.05,body:i.width*.03};s({id:ye(),type:"text",name:c==="head"?"Ãberschrift":c==="sub"?"Unterüberschrift":"Text",x:i.width*.1,y:i.height*.4,w:i.width*.8,h:z[c]*1.3,rotation:0,opacity:1,text:c==="head"?"Ãberschrift":c==="sub"?"Unterüberschrift":"Dein Text",fontFamily:c==="head"?"Anton":"Manrope",fontSize:z[c],fontWeight:c==="body"?500:700,align:"center",lineHeight:1.2,letterSpacing:0,color:"#ffffff",uppercase:c==="head",strokeWidth:0,strokeColor:"#000000",shadow:null})},w=c=>s({id:ye(),type:"shape",name:c,x:i.width*.3,y:i.height*.4,w:i.width*.4,h:i.width*.2,rotation:0,opacity:1,shape:c,fill:t.primary,gradient:null,borderWidth:0,borderColor:"#ffffff",radius:i.width*.03,shadow:null}),g=(c,z)=>s({id:ye(),type:"image",name:z,x:i.width*.25,y:i.height*.3,w:i.width*.5,h:i.width*.5,rotation:0,opacity:1,src:c,fit:"contain",mask:"none",radius:0,filters:{brightness:1,contrast:1,saturate:1,blur:0,grayscale:0},borderWidth:0,borderColor:"#ffffff",shadow:null}),C=[{angle:160,stops:[{color:t.primary,pos:0},{color:"#05070d",pos:1}]},{angle:135,stops:[{color:t.primary,pos:0},{color:t.secondary,pos:1}]},{angle:180,stops:[{color:"#05070d",pos:0},{color:t.primary,pos:.8},{color:"#05070d",pos:1}]},{angle:90,stops:[{color:"#111318",pos:0},{color:"#2a2f3a",pos:1}]}],E=async c=>{if(c)for(const z of Array.from(c)){const p=await m(z);p&&g(p.url,p.name)}};return a.jsxs(Et,{defaultValue:"templates",className:"flex flex-col h-full",children:[a.jsxs(Tt,{className:"grid grid-cols-5 mx-2 mt-2",children:[a.jsx(ue,{value:"templates",className:"text-[10px]",children:"Vorlagen"}),a.jsx(ue,{value:"text",className:"text-[10px]",children:"Text"}),a.jsx(ue,{value:"shapes",className:"text-[10px]",children:"Formen"}),a.jsx(ue,{value:"media",className:"text-[10px]",children:"Bilder"}),a.jsx(ue,{value:"bg",className:"text-[10px]",children:"Hinterg."})]}),a.jsxs(Dt,{className:"flex-1 min-h-0",children:[a.jsxs(ge,{value:"templates",className:"p-3 space-y-3 m-0",children:[a.jsx(ce,{placeholder:"Vorlagen suchen â¦",value:o,onChange:c=>n(c.target.value),className:"h-9"}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:u.map(c=>a.jsxs("button",{onClick:()=>r(c),className:"rounded-xl border border-border/40 bg-card/60 p-2 text-left hover:border-primary/50 transition-colors",children:[a.jsx(Ci,{template:c,brand:t,className:"mb-2"}),a.jsx("p",{className:"text-[11px] font-semibold leading-tight",children:c.name}),a.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[c.category," · ",c.style]})]},c.id))})]}),a.jsxs(ge,{value:"text",className:"p-3 space-y-2 m-0",children:[a.jsx(k,{variant:"secondary",className:"w-full justify-start h-12 text-xl font-black",onClick:()=>b("head"),children:"Ãberschrift"}),a.jsx(k,{variant:"secondary",className:"w-full justify-start h-10 text-base font-bold",onClick:()=>b("sub"),children:"Unterüberschrift"}),a.jsx(k,{variant:"secondary",className:"w-full justify-start h-9 text-sm",onClick:()=>b("body"),children:"FlieÃtext"}),a.jsx("p",{className:"text-[11px] text-muted-foreground pt-2",children:"Verfügbare Schriften"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:lt.map(c=>a.jsx("span",{className:"text-[10px] px-2 py-1 rounded-md bg-muted/50",style:{fontFamily:`"${c.family}", sans-serif`},children:c.label},c.family))})]}),a.jsx(ge,{value:"shapes",className:"p-3 m-0",children:a.jsx("div",{className:"grid grid-cols-3 gap-2",children:Ei.map(c=>a.jsx("button",{onClick:()=>w(c.kind),className:"aspect-square rounded-lg border border-border/40 bg-card/60 hover:border-primary/50 text-[10px] text-muted-foreground flex items-center justify-center p-1 text-center",children:c.label},c.kind))})}),a.jsxs(ge,{value:"media",className:"p-3 space-y-3 m-0",children:[a.jsx("input",{ref:f,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:c=>E(c.target.files)}),a.jsxs(k,{className:"w-full",onClick:()=>{var c;return(c=f.current)==null?void 0:c.click()},disabled:j,children:[j?a.jsx(ze,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(Ba,{className:"w-4 h-4 mr-2"}),"Bild hochladen"]}),t.logo&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground mb-1.5",children:"Logos"}),a.jsx("button",{onClick:()=>g(t.logo,"Vereinslogo"),className:"w-20 h-20 rounded-lg border border-border/40 bg-card/60 p-1.5",children:a.jsx("img",{src:t.logo,alt:"Vereinslogo",className:"w-full h-full object-contain"})})]}),t.sponsors.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground mb-1.5",children:"Sponsoren"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:t.sponsors.map((c,z)=>a.jsx("button",{onClick:()=>g(c,`Sponsor ${z+1}`),className:"aspect-square rounded-lg border border-border/40 bg-white/90 p-1.5",children:a.jsx("img",{src:c,alt:`Sponsor ${z+1}`,className:"w-full h-full object-contain"})},c))})]}),e.some(c=>
84c.image_url)&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground mb-1.5",children:"Spieler"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:e.filter(c=>c.image_url).map(c=>a.jsx("button",{onClick:()=>g(c.image_url,c.name),className:"aspect-square rounded-lg overflow-hidden border border-border/40",children:a.jsx("img",{src:c.image_url,alt:c.name,className:"w-full h-full object-cover"})},c.id))})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground mb-1.5",children:"Meine Medien"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:h.map(c=>a.jsx("button",{onClick:()=>g(c.url,c.name),className:"aspect-square rounded-lg overflow-hidden border border-border/40",children:a.jsx("img",{src:c.url,alt:c.name,className:"w-full h-full object-cover"})},c.path))})]})]}),a.jsxs(ge,{value:"bg",className:"p-3 space-y-3 m-0",children:[a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Farbverläufe"}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:C.map((c,z)=>a.jsx("button",{onClick:()=>l({type:"gradient",gradient:{type:"linear",angle:c.angle,stops:c.stops}}),className:"h-16 rounded-lg border border-border/40",style:{background:_t({type:"linear",angle:c.angle,stops:c.stops})},"aria-label":`Verlauf ${z+1}`},z))}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Farben"}),a.jsx("div",{className:"grid grid-cols-5 gap-2",children:[t.primary,t.secondary,"#0b0f19","#ffffff","#f4f4f5"].map(c=>a.jsx("button",{onClick:()=>l({type:"color",color:c}),className:"aspect-square rounded-lg border border-border/40",style:{background:c},"aria-label":`Hintergrund ${c}`},c))}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Eigenes Bild als Hintergrund"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:h.map(c=>a.jsx("button",{onClick:()=>l({type:"image",src:c.url}),className:"aspect-square rounded-lg overflow-hidden border border-border/40",children:a.jsx("img",{src:c.url,alt:c.name,className:"w-full h-full object-cover"})},c.path))})]})]})]})}const Ti=t=>/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t);function he({label:t,value:e,onChange:i,brand:s,allowTransparent:r}){const l=s?[s.primary,s.secondary,"#ffffff","#0b0f19",s.background,"#f4f4f5"]:["#ffffff","#0b0f19"];return a.jsxs("div",{className:"space-y-2",children:[t&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("label",{className:"relative w-9 h-9 rounded-lg border border-border/50 overflow-hidden shrink-0",children:[a.jsx("span",{className:"absolute inset-0",style:{background:e}}),a.jsx("input",{type:"color",value:Ti(e)?e:"#ffffff",onChange:o=>i(o.target.value),className:"absolute inset-0 opacity-0 cursor-pointer","aria-label":t||"Farbe"})]}),a.jsx(ce,{value:e,onChange:o=>i(o.target.value),className:"h-9 text-xs font-mono"})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map((o,n)=>a.jsx("button",{type:"button",onClick:()=>i(o),className:de("w-6 h-6 rounded-md border border-border/50 transition-transform hover:scale-110",e.toLowerCase()===o.toLowerCase()&&"ring-2 ring-primary"),style:{background:o},"aria-label":`Farbe ${o}`},`${o}-${n}`)),r&&a.jsx("button",{type:"button",onClick:()=>i("rgba(0,0,0,0)"),className:"w-6 h-6 rounded-md border border-border/50 text-[9px] text-muted-foreground","aria-label":"Transparent",children:"0%"})]})]})}var qt=["PageUp","PageDown"],Yt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Xt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},be="Slider",[tt,Ai,zi]=xa(be),[Qt,bs]=fa(be,[zi]),[$i,Le]=Qt(be),Jt=d.forwardRef((t,e)=>{const{name:i,min:s=0,max:r=100,step:l=1,orientation:o="horizontal",disabled:n=!1,minStepsBetweenThumbs:h=0,defaultValue:m=[s],value:j,onValueChange:f=()=>{},onValueCommit:u=()=>{},inverted:b=!1,form:w,...g}=t,C=d.useRef(new Set),E=d.useRef(0),z=o==="horizontal"?Ri:Fi,[p=[],$]=wa({prop:j,defaultProp:m,onChange:W=>{var Z;(Z=[...C.current][E.current])==null||Z.focus(),f(W)}}),D=d.useRef(p);function I(W){const N=Hi(p,W);K(W,N)}function O(W){K(W,E.current)}function T(){const W=D.current[E.current];p[E.current]!==W&&u(p)}function K(W,N,{commit:Z}={commit:!1}){const te=_i(l),v=Ui(Math.round((W-s)/l)*l+s,te),M=Wt(v,[s,r]);$((L=[])=>{const U=Wi(L,M,N);if(Vi(U,h*l)){E.current=U.indexOf(M);const re=String(U)!==String(L);return re&&Z&&u(U),re?U:L}else return L})}return a.jsx($i,{scope:t.__scopeSlider,name:i,disabled:n,min:s,max:r,valueIndexToChangeRef:E,thumbs:C.current,values:p,orientation:o,form:w,children:a.jsx(tt.Provider,{scope:t.__scopeSlider,children:a.jsx(tt.Slot,{scope:t.__scopeSlider,children:a.jsx(z,{"aria-disabled":n,"data-disabled":n?"":void 0,...g,ref:e,onPointerDown:fe(g.onPointerDown,()=>{n||(D.current=p)}),min:s,max:r,inverted:b,onSlideStart:n?void 0:I,onSlideMove:n?void 0:O,onSlideEnd:n?void 0:T,onHomeKeyDown:()=>!n&&K(s,0,{commit:!0}),onEndKeyDown:()=>!n&&K(r,p.length-1,{commit:!0}),onStepKeyDown:({event:W,direction:N})=>{if(!n){const v=qt.includes(W.key)||W.shiftKey&&Yt.includes(W.key)?10:1,M=E.current,L=p[M],U=l*v*N;K(L+U,M,{commit:!0})}}})})})})});Jt.displayName=be;var[ea,ta]=Qt(be,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Ri=d.forwardRef((t,e)=>{const{min:i,max:s,dir:r,inverted:l,onSlideStart:o,onSlideMove:n,onSlideEnd:h,onStepKeyDown:m,...j}=t,[f,u]=d.useState(null),b=we(e,z=>u(z)),w=d.useRef(void 0),g=ba(r),C=g==="ltr",E=C&&!l||!C&&l;function c(z){const p=w.current||f.getBoundingClientRect(),$=[0,p.width],I=ct($,E?[i,s]:[s,i]);return w.current=p,I(z-p.left)}return a.jsx(ea,{scope:t.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:a.jsx(aa,{dir:g,"data-orientation":"horizontal",...j,ref:b,style:{...j.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:z=>{const p=c(z.clientX);o==null||o(p)},onSlideMove:z=>{const p=c(z.clientX);n==null||n(p)},onSlideEnd:()=>{w.current=void 0,h==null||h()},onStepKeyDown:z=>{const $=Xt[E?"from-left":"from-right"].includes(z.key);m==null||m({event:z,direction:$?-1:1})}})})}),Fi=d.forwardRef((t,e)=>{const{min:i,max:s,inverted:r,onSlideStart:l,onSlideMove:o,onSlideEnd:n,onStepKeyDown:h,...m}=t,j=d.useRef(null),f=we(e,j),u=d.useRef(void 0),b=!r;function w(g){const C=u.current||j.current.getBoundingClientRect(),E=[0,C.height],z=ct(E,b?[s,i]:[i,s]);return u.current=C,z(g-C.top)}return a.jsx(ea,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:a.jsx(aa,{"data-orientation":"vertical",...m,ref:f,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const C=w(g.clientY);l==null||l(C)},onSlideMove:g=>{const C=w(g.clientY);o==null||o(C)},onSlideEnd:()=>{u.current=void 0,n==null||n()},onStepKeyDown:g=>{const E=Xt[b?"from-bottom":"from-top"].includes(g.key);h==null||h({event:g,direction:E?-1:1})}})})}),aa=d.forwardRef((t,e)=>{const{__scopeSlider:i,onSlideStart:s,onSlideMove:r,onSlideEnd:l,onHomeKeyDown:o,onEndKeyDown:n,onStepKeyDown:h,...m}=t,j=Le(be,i);return a.jsx($e.span,{...m,ref:e,onKeyDown:fe(t.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(n(f),f.preventDefault()):qt.concat(Yt).includes(f.key)&&(h(f),f.preventDefault())}),onPointerDown:fe(t.onPointerDown,f=>{const u=f.target;u.setPointerCapture(f.pointerId),f.preventDefault(),j.thumbs.has(u)?u.focus():s(f)}),onPointerMove:fe(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&r(f)}),onPointerUp:fe(t.onPointerUp,f=>{const u=f.target;u.hasPointerCapture(f.pointerId)&&(u.releasePointerCapture(f.pointerId),l(f))})})}),ia="SliderTrack",sa=d.forwardRef((t,e)=>{const{__scopeSlider:i,...s}=t,r=Le(ia,i);return a.jsx($e.span,{"data-disabled":r.disabled?"":void 0,"data-orientation":r.orientation,...s,ref:e})});
84sa.displayName=ia;var at="SliderRange",na=d.forwardRef((t,e)=>{const{__scopeSlider:i,...s}=t,r=Le(at,i),l=ta(at,i),o=d.useRef(null),n=we(e,o),h=r.values.length,m=r.values.map(u=>la(u,r.min,r.max)),j=h>1?Math.min(...m):0,f=100-Math.max(...m);return a.jsx($e.span,{"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,...s,ref:n,style:{...t.style,[l.startEdge]:j+"%",[l.endEdge]:f+"%"}})});na.displayName=at;var it="SliderThumb",ra=d.forwardRef((t,e)=>{const i=Ai(t.__scopeSlider),[s,r]=d.useState(null),l=we(e,n=>r(n)),o=d.useMemo(()=>s?i().findIndex(n=>n.ref.current===s):-1,[i,s]);return a.jsx(Ii,{...t,ref:l,index:o})}),Ii=d.forwardRef((t,e)=>{const{__scopeSlider:i,index:s,name:r,...l}=t,o=Le(it,i),n=ta(it,i),[h,m]=d.useState(null),j=we(e,c=>m(c)),f=h?o.form||!!h.closest("form"):!0,u=ja(h),b=o.values[s],w=b===void 0?0:la(b,o.min,o.max),g=Pi(s,o.values.length),C=u==null?void 0:u[n.size],E=C?Bi(C,w,n.direction):0;return d.useEffect(()=>{if(h)return o.thumbs.add(h),()=>{o.thumbs.delete(h)}},[h,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[n.startEdge]:`calc(${w}% + ${E}px)`},children:[a.jsx(tt.ItemSlot,{scope:t.__scopeSlider,children:a.jsx($e.span,{role:"slider","aria-label":t["aria-label"]||g,"aria-valuemin":o.min,"aria-valuenow":b,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...l,ref:j,style:b===void 0?{display:"none"}:t.style,onFocus:fe(t.onFocus,()=>{o.valueIndexToChangeRef.current=s})})}),f&&a.jsx(oa,{name:r??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},s)]})});ra.displayName=it;var Di="RadioBubbleInput",oa=d.forwardRef(({__scopeSlider:t,value:e,...i},s)=>{const r=d.useRef(null),l=we(r,s),o=va(e);return d.useEffect(()=>{const n=r.current;if(!n)return;const h=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(h,"value").set;if(o!==e&&j){const f=new Event("input",{bubbles:!0});j.call(n,e),n.dispatchEvent(f)}},[o,e]),a.jsx($e.input,{style:{display:"none"},...i,ref:l,defaultValue:e})});oa.displayName=Di;function Wi(t=[],e,i){const s=[...t];return s[i]=e,s.sort((r,l)=>r-l)}function la(t,e,i){const l=100/(i-e)*(t-e);return Wt(l,[0,100])}function Pi(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Hi(t,e){if(t.length===1)return 0;const i=t.map(r=>Math.abs(r-e)),s=Math.min(...i);return i.indexOf(s)}function Bi(t,e,i){const s=t/2,l=ct([0,50],[0,s]);return(s-l(e)*i)*i}function Li(t){return t.slice(0,-1).map((e,i)=>t[i+1]-e)}function Vi(t,e){if(e>0){const i=Li(t);return Math.min(...i)>=e}return!0}function ct(t,e){return i=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(i-t[0])}}function _i(t){return(String(t).split(".")[1]||"").length}function Ui(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}var ca=Jt,Oi=sa,Gi=na,Ki=ra;const Q=d.forwardRef(({className:t,...e},i)=>
84a.jsxs(ca,{ref:i,className:de("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Oi,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(Gi,{className:"absolute h-full bg-primary"})}),a.jsx(Ki,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Q.displayName=ca.displayName;const V=({label:t,children:e})=>a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(ka,{className:"text-xs text-muted-foreground",children:t}),e]});function St({element:t,doc:e,brand:i,format:s,onPatch:r,onBackground:l}){if(!t)return a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsx("p",{className:"text-sm font-semibold",children:"Hintergrund"}),a.jsx(he,{label:"Farbe",value:e.background.color,onChange:n=>l({type:"color",color:n}),brand:i}),e.background.type==="image"&&a.jsx(V,{label:`Abdunkeln (${Math.round((e.background.overlay||0)*100)} %)`,children:a.jsx(Q,{value:[(e.background.overlay||0)*100],max:90,step:5,onValueChange:([n])=>l({overlay:n/100})})}),a.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Wähle ein Element aus, um es zu bearbeiten."})]});const o=a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(V,{label:"X",children:a.jsx(ce,{type:"number",value:Math.round(t.x),onChange:n=>r({x:Number(n.target.value)}),className:"h-8"})}),a.jsx(V,{label:"Y",children:a.jsx(ce,{type:"number",value:Math.round(t.y),onChange:n=>r({y:Number(n.target.value)}),className:"h-8"})}),a.jsx(V,{label:"Breite",children:a.jsx(ce,{type:"number",value:Math.round(t.w),onChange:n=>r({w:Number(n.target.value)}),className:"h-8"})}),a.jsx(V,{label:"Höhe",children:a.jsx(ce,{type:"number",value:Math.round(t.h),onChange:n=>r({h:Number(n.target.value)}),className:"h-8"})})]}),a.jsx(V,{label:`Drehung (${Math.round(t.rotation)}°)`,children:a.jsx(Q,{value:[t.rotation],min:-180,max:180,step:1,onValueChange:([n])=>r({rotation:n})})}),a.jsx(V,{label:`Transparenz (${Math.round(t.opacity*100)} %)`,children:a.jsx(Q,{value:[t.opacity*100],min:5,max:100,step:1,onValueChange:([n])=>r({opacity:n/100})})}),s&&a.jsx(V,{label:"Auf Fläche ausrichten",children:a.jsxs("div",{className:"grid grid-cols-3 gap-1",children:[a.jsx(k,{type:"button",size:"sm",variant:"secondary",className:"h-8 text-[10px]",onClick:()=>r({x:0},!0),children:"Links"}),a.jsx(k,{type:"button",size:"sm",variant:"secondary",className:"h-8 text-[10px]",onClick:()=>r({x:(s.width-t.w)/2},!0),children:"H-Mitte"}),a.jsx(k,{type:"button",size:"sm",variant:"secondary",className:"h-8 text-[10px]",onClick:()=>r({x:s.width-t.w},!0),children:"Rechts"}),a.jsx(k,{type:"button",size:"sm",variant:"secondary",className:"h-8 text-[10px]",onClick:()=>r({y:0},!0),children:"Oben"}),a.jsx(k,{type:"button",size:"sm",variant:"secondary",className:"h-8 text-[10px]",onClick:()=>r({y:(s.height-t.h)/2},!0),children:"V-Mitte"}),a.jsx(k,{type:"button",size:"sm",variant:"secondary",className:"h-8 text-[10px]",onClick:()=>r({y:s.height-t.h},!0),children:"Unten"})]})})]});return a.jsxs("div",{className:"p-4 space-y-5",children:[t.type==="text"&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(V,{label:"Text",children:a.jsx(Sa,{value:t.text,onChange:n=>r({text:n.target.value}),className:"min-h-[80px] text-sm"})}),a.jsx(V,{label:"Schriftart",children:a.jsxs(Ce,{value:t.fontFamily,onValueChange:n=>r({fontFamily:n}),children:[a.jsx(Ee,{className:"h-9",children:a.jsx(Te,{})}),a.jsx(Ae,{children:lt.map(n=>a.jsx(me,{value:n.family,children:a.jsx("span",{style:{fontFamily:`"${n.family}", sans-serif`},children:n.label})},n.family))})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(V,{label:"GröÃe",children:a.jsx(ce,{type:"number",value:Math.round(t.fontSize),onChange:n=>r({fontSize:Number(n.target.value)}),className:"h-8"})}),a.jsx(V,{label:"Gewicht",children:a.jsxs(Ce,{value:String(t.fontWeight),onValueChange:n=>r({fontWeight:Number(n)}),children:[a.jsx(Ee,{className:"h-8",children:a.jsx(Te,{})}),a.jsx(Ae,{children:[300,400,500,600,700,800,900].map(n=>a.jsx(me,{value:String(n),children:n},n))})]})})]}),a.jsxs("div",{className:"flex gap-1",children:[["left","center","right"].map(n=>{const h=n==="left"?Ua:n==="center"?_a:Oa;return a.jsx(k,{type:"button",size:"icon",variant:t.align===n?"default":"secondary",className:"h-8 w-8",onClick:()=>r({align:n}),"aria-label":n,children:a.jsx(h,{className:"w-3.5 h-3.5"})},n)}),a.jsx(k,{type:"button",size:"sm",variant:t.italic?"default":"secondary",className:"h-8 italic",onClick:()=>r({italic:!t.italic}),children:"K"}),a.jsx(k,{type:"button",size:"sm",variant:t.uppercase?"default":"secondary",className:"h-8",onClick:()=>r({uppercase:!t.uppercase}),children:"AA"}),a.jsx(k,{type:"button",size:"sm",variant:t.autoFit===!1?"secondary":"default",className:"h-8 text-[10px]",title:"Text automatisch in de
84n Rahmen einpassen",onClick:()=>r({autoFit:t.autoFit===!1}),children:"FIT"})]}),a.jsx(V,{label:`Zeilenhöhe (${t.lineHeight.toFixed(2)})`,children:a.jsx(Q,{value:[t.lineHeight*100],min:80,max:220,step:5,onValueChange:([n])=>r({lineHeight:n/100})})}),a.jsx(V,{label:`Buchstabenabstand (${Math.round(t.letterSpacing)})`,children:a.jsx(Q,{value:[t.letterSpacing],min:-10,max:80,step:1,onValueChange:([n])=>r({letterSpacing:n})})}),a.jsx(he,{label:"Farbe",value:t.color,onChange:n=>r({color:n}),brand:i}),a.jsx(V,{label:`Kontur (${t.strokeWidth||0} px)`,children:a.jsx(Q,{value:[t.strokeWidth||0],max:20,step:1,onValueChange:([n])=>r({strokeWidth:n})})}),!!t.strokeWidth&&a.jsx(he,{label:"Konturfarbe",value:t.strokeColor||"#000000",onChange:n=>r({strokeColor:n}),brand:i}),a.jsx(k,{variant:"secondary",size:"sm",className:"w-full",onClick:()=>r({shadow:t.shadow?null:{x:0,y:8,blur:24,color:"rgba(0,0,0,0.45)"}}),children:t.shadow?"Schatten entfernen":"Schatten hinzufügen"})]}),t.type==="shape"&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(he,{label:"Füllfarbe",value:t.fill,onChange:n=>r({fill:n,gradient:null}),brand:i,allowTransparent:!0}),a.jsx(k,{variant:"secondary",size:"sm",className:"w-full",onClick:()=>r({gradient:t.gradient?null:{type:"linear",angle:135,stops:[{color:i.primary,pos:0},{color:i.secondary,pos:1}]}}),children:t.gradient?"Verlauf entfernen":"Verlauf anwenden"}),t.gradient&&a.jsxs(a.Fragment,{children:[a.jsx(he,{label:"Verlauf Start",value:t.gradient.stops[0].color,onChange:n=>r({gradient:{...t.gradient,stops:[{...t.gradient.stops[0],color:n},t.gradient.stops[1]]}}),brand:i}),a.jsx(he,{label:"Verlauf Ende",value:t.gradient.stops[1].color,onChange:n=>r({gradient:{...t.gradient,stops:[t.gradient.stops[0],{...t.gradient.stops[1],color:n}]}}),brand:i}),a.jsx(V,{label:`Winkel (${t.gradient.angle}°)`,children:a.jsx(Q,{value:[t.gradient.angle],max:360,step:5,onValueChange:([n])=>r({gradient:{...t.gradient,angle:n}})})})]}),a.jsx(V,{label:`Ecken-Radius (${Math.round(t.radius)})`,children:a.jsx(Q,{value:[t.radius],max:Math.max(40,t.h/2),step:2,onValueChange:([n])=>r({radius:n})})}),a.jsx(V,{label:`Rahmen (${t.borderWidth} px)`,children:a.jsx(Q,{value:[t.borderWidth],max:30,step:1,onValueChange:([n])=>r({borderWidth:n})})}),t.borderWidth>0&&a.jsx(he,{label:"Rahmenfarbe",value:t.borderColor,onChange:n=>r({borderColor:n}),brand:i})]}),t.type==="image"&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(V,{label:"Zuschnitt",children:a.jsxs(Ce,{value:t.fit,onValueChange:n=>r({fit:n}),children:[a.jsx(Ee,{className:"h-8",children:a.jsx(Te,{})}),a.jsxs(Ae,{children:[a.jsx(me,{value:"cover",children:"Füllend (cover)"}),a.jsx(me,{value:"contain",children:"Einpassen (contain)"})]})]})}),a.jsx(V,{label:"Maske",children:a.jsxs(Ce,{value:t.mask,onValueChange:n=>r({mask:n}),children:[a.jsx(Ee,{className:"h-8",children:a.jsx(Te,{})}),a.jsx(Ae,{children:["none","circle","roundrect","hexagon","diagonal","shield"].map(n=>a.jsx(me,{value:n,children:n==="none"?"Keine":n},n))})]})}),["brightness","contrast","saturate"].map(n=>a.jsx(V,{label:`${n==="brightness"?"Helligkeit":n==="contrast"?"Kontrast":"Sättigung"} (${Math.round(t.filters[n]*100)} %)`,children:a.jsx(Q,{value:[t.filters[n]*100],min:20,max:200,step:5,onValueChange:([h])=>r({filters:{...t.filters,[n]:h/100}})})},n)),a.jsx(V,{label:`Unschärfe (${t.filters.blur} px)`,children:a.jsx(Q,{value:[t.filters.blur],max:20,step:1,onValueChange:([n])=>r({filters:{...t.filters,blur:n}})})}),a.jsx(V,{label:`Schwarzweià (${Math.round(t.filters.grayscale*100)} %)`,children:a.jsx(Q,{value:[t.filters.grayscale*100],max:100,step:5,onValueChange:([n])=>r({filters:{...t.filters,grayscale:n/100}})})}),a.jsx(V,{label:`Rahmen (${t.borderWidth} px)`,children:a.jsx(Q,{value:[t.borderWidth],max:30,step:1,onValueChange:([n])=>r({borderWidth:n})})}),t.borderWidth>0&&a.jsx(he,{label:"Rahmenfarbe",value:t.borderColor,onChange:n=>r({borderColor:n}),brand:i}),a.jsx(k,{variant:"secondary",size:"sm",className:"w-full",onClick:()=>r({shadow:t.shadow?null:{x:0,y:12,blur:30,color:"rgba(0,0,0,0.5)"}}),children:t.shadow?"Schatten entfernen":"Schatten hinzufügen"})]}),a.jsx("div",{className:"pt-2 border-t border-border/30",children:o})]})}const Zi=t=>t.type==="text"?ei:t.type==="image"?qe:Ja,qi=t=>t.name||(t.type==="text"?t.text.slice(0,22):t.type==="image"?"Bild":"Form");function kt({elements:t,selectedId:e,onSelect:i,onPatch:s,onMove:r,onDelete:l}){const o=[...t].reverse();return a.jsxs("div",{className:"space-y-1",children:[o.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground
84/70 py-4 text-center",children:"Noch keine Ebenen"}),o.map(n=>{const h=Zi(n);return a.jsxs("div",{onClick:()=>i(n.id),className:de("group flex items-center gap-2 px-2 py-1.5 rounded-lg cursor-pointer border border-transparent",e===n.id?"bg-primary/10 border-primary/40":"hover:bg-muted/50"),children:[a.jsx(h,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0",strokeWidth:1.5}),a.jsx("span",{className:"text-xs truncate flex-1",children:qi(n)}),a.jsxs("div",{className:"flex items-center opacity-60 group-hover:opacity-100",children:[a.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:m=>{m.stopPropagation(),r(n.id,"up")},"aria-label":"Nach vorne",children:a.jsx(Ka,{className:"w-3 h-3"})}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:m=>{m.stopPropagation(),r(n.id,"down")},"aria-label":"Nach hinten",children:a.jsx(Ga,{className:"w-3 h-3"})}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:m=>{m.stopPropagation(),s(n.id,{hidden:!n.hidden})},"aria-label":"Sichtbarkeit",children:n.hidden?a.jsx(qa,{className:"w-3 h-3"}):a.jsx(Na,{className:"w-3 h-3"})}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:m=>{m.stopPropagation(),s(n.id,{locked:!n.locked})},"aria-label":"Sperren",children:n.locked?a.jsx(Ma,{className:"w-3 h-3"}):a.jsx(Ya,{className:"w-3 h-3"})}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:m=>{m.stopPropagation(),l(n.id)},"aria-label":"Löschen",children:a.jsx(nt,{className:"w-3 h-3"})})]})]},n.id)})]})}const Yi=Ta,Xi=Aa,da=d.forwardRef(({className:t,...e},i)=>
84a.jsx(At,{className:de("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:i}));da.displayName=At.displayName;const Qi=za("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),ha=d.forwardRef(({side:t="right",className:e,children:i,...s},r)=>a.jsxs(Xi,{children:[a.jsx(da,{}),a.jsxs(zt,{ref:r,className:de(Qi({side:t}),e),...s,children:[i,a.jsxs(Ca,{className:"absolute right-4 top-4 roun
84ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(Ea,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ha.displayName=zt.displayName;const ua=d.forwardRef(({className:t,...e},i)=>a.jsx($t,{ref:i,className:de("text-lg font-semibold text-foreground",t),...e}));ua.displayName=$t.displayName;const Ji=d.forwardRef(({className:t,...e},i)=>a.jsx(Rt,{ref:i,className:de("text-sm text-muted-foreground",t),...e}));Ji.displayName=Rt.displayName;const es=(t,e)=>t.unit==="mm"?1:e==="max"?2:1,ts=t=>t==="jpg"?"image/jpeg":t==="webp"?"image/webp":"image/png";function Nt(t){const e=t.split(",")[1]||"";return Math.round(e.length*3/4)}async function as(t,e,i){const s=es(e,i.quality),r=await ot(t,e,s);if(i.type==="pdf"){const o=r.toDataURL("image/jpeg",.98),n=e.unit==="mm"&&!!e.mmWidth&&!!e.mmHeight,h=n?e.mmWidth:e.width,m=n?e.mmHeight:e.height,j=new La({orientation:h>=m?"landscape":"portrait",unit:n?"mm":"px",format:[h,m],compress:!0});j.addImage(o,"JPEG",0,0,h,m);const f=j.output("datauristring");return{dataUrl:f,width:e.width,height:e.height,bytes:Nt(f),type:"pdf"}}const l=r.toDataURL(ts(i.type),i.type==="png"?void 0:.95);return{dataUrl:l,width:r.width,height:r.height,bytes:Nt(l),type:i.type}}function is(t,e){const i=t.type==="jpg"?"jpg":t.type,s=document.createElement("a");s.href=t.dataUrl,s.download=`${e.replace(/[^\w\-. äöüÃÃÃÃ]/g,"_")}.${i}`,document.body.appendChild(s),s.click(),s.remove()}async function ss(t,e){const i=Math.min(1,400/Math.max(e.width,e.height));return(await ot(t,e,i)).toDataURL("image/jpeg",.7)}function ns(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const rs=t=>`media-draft-${t}`;function os({design:t,brand:e,players:i,vars:s,games:r=[],selectedGameId:l=null,onSelectGame:o,onBack:n,onSave:h,onSaveAsTemplate:m,onDuplicate:j}){const[f,u]=d.useState(!1),[b,w]=d.useState(t.doc),[g,C]=d.useState(t.name),[E,c]=d.useState(null),[z,p]=d.useState(1),[$,D]=d.useState([t.doc]),[I,O]=d.useState(0),[T,K]=d.useState(!1),[W,N]=d.useState("none"),[Z,te]=d.useState(!1),[v,M]=d.useState(null),[L,U]=d.useState(!1),re=d.useRef(null),F=t.format;d.useEffect(()=>{localStorage.setItem(rs(t.id),JSON.stringify({doc:b,name:g}))},[b,g,t.id]);const P=d.useCallback(y=>{D(S=>[...S.slice(0,I+1),y].slice(-60)),O(S=>Math.min(S+1,59))},[I]),_=b.elements.find(y=>y.id===E)||null,ne=d.useCallback((y,S,A=!0)=>{w(H=>{const ie={...H,elements:H.elements.map(se=>se.id===y?{...se,...S}:se)};return A&&P(ie),ie})},[P]),ae=d.useCallback(y=>{w(S=>{const A={...S,elements:[...S.elements,y]};return P(A),A}),c(y.id),N("none")},[P]),J=d.useCallback(y=>{w(S=>{const A={...S,elements:S.elements.filter(H=>H.id!==y)};return P(A),A}),c(null)},[P]),dt=d.useCallback((y,S)=>{w(A=>{const H=A.elements.findIndex(pa=>pa.id===y),ie=S==="up"?H+1:H-1;if(H<0||ie<0||ie>=A.elements.length)return A;const se=[...A.elements];[se[H],se[ie]]=[se[ie],se[H]];const Ie={...A,elements:se};return P(Ie),Ie})},[P]),Re=d.useCallback(y=>{w(S=>{const A={...S,background:{...S.background,...y}};return P(A),A})},[P]),ht=d.useCallback(y=>{const S=y.build(e,F),A={...S,elements:S.elements.map(H=>H.type==="text"?{...H,template:H.text,text:pt(H.text,s)}:H)};w(A),P(A),c(null),N("none"),Y.success(`Vorlage â${y.name}â angewendet`)},[e,F,s,P]),ga=d.useCallback(()=>{w(y=>{const S={...y,elements:y.elements.map(A=>{if(A.type!=="text")return A;const H=A.template??(A.text.includes("{{")?A.text:null);return H?{...A,template:H,text:pt(H,s)}:A})};return P(S),S}),Y.success("Daten aktualisiert")},[s,P]),Ve=d.useCallback(()=>{I<=0||(O(y=>y-1),w($[I-1]))},[$,I]),_e=d.useCallback(()=>{I>=$.length-1||(O(y=>y+1),w($[I+1]))},[$,I]),Fe=d.useCallback(y=>{ae({...y,id:ye(),x:y.x+24,y:y.y+24})},[ae]);d.useEffect(()=>{const y=S=>{const A=S.target;if(["INPUT","TEXTAREA"].includes(A.tagName)||A.isContentEditable)return;const H=S.metaKey||S.ctrlKey;if(H&&S.key.toLowerCase()==="z")S.preventDefault(),S.shiftKey?_e():Ve();else if(H&&S.key.toLowerCase()==="c"&&_)re.current=_;else if(H&&S.key.toLowerCase()==="v"&&re.current)Fe(re.current);else if(H&&S.key.toLowerCase()==="d"&&_)S.preventDefault(),Fe(_);else if((S.key==="Delete"||S.key==="Backspace")&&_)S.preventDefault(),J(_.id);else if(_&&S.key.startsWith("Arrow")){S.preventDefault();const ie=S.shiftKey?20:2,se=S.key==="ArrowLeft"?-ie:S.key==="ArrowRight"?ie:0,Ie=S.key==="ArrowUp"?-ie:S.key==="ArrowDown"?ie:0;ne(_.id,{x:_.x+se,y:_.y+Ie})}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[_,Ve,_e,J,Fe,ne]);const Ue=d.useCallback(async(y=!0)=>{K(!0);try{const S=await ss(b,F);await h(b,g,S),y||Y.success("Design gespeichert")}finally{K(!1)}},[b,F,g,h]);d.useEffect(()=>{const y=setTimeout(()=>{Ue(!0)},2500);return()=>clearTimeout(y)},[b,g]);const Oe=d.useCallback(async(y,S)=>{U(!0);try{const A=await as(b,F,{type:y,quality:S});M(A)}catch(A){console.error(A),Y.error("Export fehlgeschlagen")}finally{U(!1)}},[b,F]),ut=a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(k,{variant:"ghost",size:"icon",onClick:Ve,disabled:I<=0,"aria-label":"Rückgängig",children:a.jsx(ti,{className:"w-4 h-4"})}),a.jsx(k,{variant:"ghost",size:"icon",onClick:_e,disabled:I>=$.length-1,"aria-label":"Wiederholen",children:a.jsx(Xa,{className:"w-4 h-4"})}),a.jsx(k,{variant:"ghost",size:"icon",onClick:()=>p(y=>Math.max(.2,y-.2)),"aria-label":"Verkleinern",children:a.jsx(ii,{className:"w-4 h-4"})}),a.jsx(k,{variant:"ghost",size:"icon",onClick:()=>p(y=>Math.min(4,y+.2)),"aria-label":"VergröÃern",children:a.jsx(ai,{className:"w-4 h-4"})}),_&&a.jsxs(a.Fragment,{children:[a.jsx(k,{variant:"ghost",size:"icon",onClick:()=>Fe(_),"aria-label":"Element duplizieren",children:a.jsx(Ft,{className:"w-4 h-4"})}),a.jsx(k,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>J(_.id),"aria-label":"Element löschen",children:a.jsx(nt,{className:"w-4 h-4"})})]})]}),ma=d.useMemo(()=>s,[s]);return a.jsxs("div",{className:"fixed inset-0 z-50 bg-background flex flex-col",children:[a.jsxs("header",{className:"flex items-center gap-2 px-3 py-2 border-b border-border/30 shrink-0",children:[a.jsx(k,{variant:"ghost",size:"icon",onClick:n,"aria-label":"Zurück",children:a.jsx($a,{className:"w-4 h-4"})}),a.jsx(ce,{value:g,onChange:y=>C(y.target.value),className:"h-8 w-32 sm:w-56 text-sm"}),a.jsxs("span",{className:"hidden md:block text-[11px] text-muted-foreground",children:[F.name," · ",F.width,"Ã",F.height," px"]}),a.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[a.jsx("div",{className:"hidden sm:flex",children:ut}),a.jsxs(k,{variant:"secondary",size:"sm",onClick:()=>u(!0),children:[a.jsx(Za,{className:"w-4 h-4 sm:mr-1.5"}),a.jsx("span",{className:"hidden sm:inline",children:"Teamdaten"})]}),a.jsxs(k,{variant:"secondary",size:"sm",onClick:()=>Ue(!1),disabled:T,children:[T?a.jsx(ze,{className:"w-4 h-4 animate-spin sm:mr-1.5"}):a.jsx(Va,{className:"w-4 h-4 sm:mr-1.5"}),a.jsx("span",{className:"hidden sm:inline",children:"Speichern"})]}),a.jsxs(k,{size:"sm",onClick:()=>{M(null),te(!0)},children:[a.jsx(Ra,{className:"w-4 h-4 sm:mr-1.5"}),a.jsx("span",{className:"hidden sm:inline",children:"Export"})]})]})]}),a.jsxs("div",{className:"flex flex-1 min-h-0",children:[a.jsx("aside",{className:"hidden lg:flex w-72 border-r border-border/30 flex-col min-h-0",children:a.jsx(vt,{brand:e,players:i,format:F,onAddElement:ae,onApplyTemplate:ht,onSetBackgroun
84d:Re})}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsx(Si,{doc:b,format:F,selectedId:E,zoom:z,onSelect:c,onUpdateElement:(y,S,A)=>ne(y,S,A)}),a.jsxs("div",{className:"lg:hidden border-t border-border/30 p-2 flex items-center justify-between gap-2",children:[ut,a.jsxs("div",{className:"flex gap-1.5",children:[a.jsxs(k,{size:"sm",variant:"secondary",onClick:()=>N("assets"),children:[a.jsx(It,{className:"w-4 h-4 mr-1"}),"Hinzufügen"]}),a.jsx(k,{size:"sm",variant:"secondary",onClick:()=>N("props"),children:a.jsx(Qa,{className:"w-4 h-4"})}),a.jsx(k,{size:"sm",variant:"secondary",onClick:()=>N("layers"),children:a.jsx(gt,{className:"w-4 h-4"})})]})]})]}),a.jsx("aside",{className:"hidden lg:flex w-80 border-l border-border/30 flex-col min-h-0",children:a.jsxs(Dt,{className:"flex-1 min-h-0",children:[a.jsx(St,{element:_,doc:b,brand:e,format:F,onPatch:y=>_&&ne(_.id,y),onBackground:Re}),a.jsxs("div",{className:"p-4 border-t border-border/30",children:[a.jsxs("p",{className:"text-sm font-semibold mb-2 flex items-center gap-1.5",children:[a.jsx(gt,{className:"w-4 h-4",strokeWidth:1.5}),"Ebenen"]}),a.jsx(kt,{elements:b.elements,selectedId:E,onSelect:c,onPatch:(y,S)=>ne(y,S),onMove:dt,onDelete:J})]})]})})]}),a.jsx(Yi,{open:W!=="none",onOpenChange:y=>!y&&N("none"),children:a.jsxs(ha,{side:"bottom",className:"h-[75vh] overflow-y-auto p-0",children:[a.jsx(ua,{className:"sr-only",children:"Werkzeuge"}),W==="assets"&&a.jsx("div",{className:"h-[72vh]",children:a.jsx(vt,{brand:e,players:i,format:F,onAddElement:ae,onApplyTemplate:ht,onSetBackground:Re})}),W==="props"&&a.jsx(St,{element:_,doc:b,brand:e,format:F,onPatch:y=>_&&ne(_.id,y),onBackground:Re}),W==="layers"&&a.jsx("div",{className:"p-4",children:a.jsx(kt,{elements:b.elements,selectedId:E,onSelect:c,onPatch:(y,S)=>ne(y,S),onMove:dt,onDelete:J})})]})}),a.jsx(Ye,{open:f,onOpenChange:u,children:a.jsxs(Xe,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsx(Qe,{children:a.jsx(Je,{children:"Teamdaten einsetzen"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Spiel als Datenquelle"}),a.jsxs(Ce,{value:l??"none",onValueChange:y=>o==null?void 0:o(y==="none"?null:y),children:[a.jsx(Ee,{className:"h-9",children:a.jsx(Te,{placeholder:"Spiel wählen"})}),a.jsxs(Ae,{children:[a.jsx(me,{value:"none",children:"Kein Spiel (Beispielwerte)"}),xt(r).upcoming.slice(0,10).map(y=>a.jsxs(me,{value:y.id,children:["Kommend · ",yt(y)]},y.id)),xt(r).recent.slice(0,10).map(y=>a.jsxs(me,{value:y.id,children:["Vergangen · ",yt(y)]},y.id))]})]})]}),a.jsx(k,{size:"sm",className:"w-full",onClick:()=>{ga(),u(!1)},children:"Platzhalter mit diesen Daten füllen"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Verfügbare Platzhalter"}),a.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Object.entries(s).map(([y,S])=>a.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 px-2 py-1.5",children:[a.jsx("p",{className:"text-[10px] font-mono text-primary",children:`{{${y}}}`}),a.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:S||"â"})]},y))}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Platzhalter direkt in Textelemente schreiben â beim Füllen werden sie ersetzt."})]})]})]})}),a.jsx(Ye,{open:Z,onOpenChange:te,children:a.jsxs(Xe,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsx(Qe,{children:a.jsx(Je,{children:"Export"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"grid grid-cols-4 gap-2",children:["png","jpg","webp","pdf"].map(y=>a.jsx(k,{variant:"secondary",size:"sm",onClick:()=>Oe(y,"max"),disabled:L,children:y.toUpperCase()},y))}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(k,{variant:"outline",size:"sm",onClick:()=>Oe("jpg","social"),disabled:L,children:"Für Social Media"}),a.jsx(k,{variant:"outline",size:"sm",onClick:()=>Oe("png","max"),disabled:L,children:"Maximale Qualität"})]}),L&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(ze,{className:"w-4 h-4 animate-spin"}),"Wird gerendert â¦"]}),v&&a.jsxs("div",{className:"space-y-3",children:[v.type!=="pdf"&&a.jsx("img",{src:v.dataUrl,alt:"Vorschau",className:"w-full rounded-lg border border-border/40"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[F.name," · ",v.width," à ",v.height," px · ",v.type.toUpperCase()," · ",ns(v.bytes)]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[a.jsx(k,{size:"sm",onClick:()=>is(v,g),children:"Download"}),a.jsx(k,{size:"sm",variant:"secondary",onClick:()=>Ue(!1),children:"Design speichern"}),a.jsx(k,{size:"sm",variant:"secondary",onClick:()=>m(b,g),children:"Als Vorlage"})]}),a.jsx(k,{size:"sm",variant:"ghost",className:"w-full",onClick:j,children:"Design duplizieren"})]})]})]})}),a.jsx("span",{className:"hidden",children:Object.keys(ma).length})]})}const ls=[{label:"FuÃball",formats:Bt},{label:"Social Media",formats:Pt},{label:"Print",formats:Ht}];function js(){const{team:t,players:e}=Ct(),{designs:i,templates:s,projects:r,isLoading:l,createDesign:o,updateDesign:n,deleteDesign:h,duplicateDesign:m,toggleFavorite:j}
84=si(),[f,u]=d.useState(null),[b,w]=d.useState(!1),[g,C]=d.useState(""),[E,c]=d.useState(!1),{games:z}=Ha(),[p,$]=d.useState(null),D=d.useMemo(()=>ni(t),[t]),I=d.useMemo(()=>z.find(v=>v.id===p)??null,[z,p]),O=d.useMemo(()=>li(D,I,e),[D,I,e]),T=i.find(v=>v.id===f)||null,K=d.useMemo(()=>{const v=g.trim().toLowerCase();return v?et.filter(M=>M.name.toLowerCase().includes(v)||M.category.toLowerCase().includes(v)||M.keywords.some(L=>L.toLowerCase().includes(v))):et},[g]),W=async(v,M,L)=>{c(!0);const U=await o({name:v,format:M,doc:L});c(!1),U&&(w(!1),u(U.id))},N=async v=>{const M=Vt(v.formatId)??Lt[0];await W(v.name,M,v.build(D,M))},Z=async v=>{await W(v.name,v,di(D))};if(T)return a.jsx(os,{design:T,brand:D,players:e,vars:O,games:z,selectedGameId:p,onSelectGame:$,onBack:()=>u(null),onSave:async(v,M,L)=>{await n(T.id,{doc:v,name:M,thumbnail:L})},onSaveAsTemplate:async(v,M)=>{await o({name:`${M} (Vorlage)`,format:T.format,doc:v,isTemplate:!0})},onDuplicate:async()=>{const v=await m(T);v&&u(v.id)}});const te=v=>l?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(ze,{className:"w-6 h-6 animate-spin text-primary"})}):v.length===0?a.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[a.jsx(qe,{className:"w-10 h-10 mx-auto mb-3 opacity-40",strokeWidth:1.5}),a.jsx("p",{className:"text-sm",children:"Noch keine Designs vorhanden"})]}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-4",children:v.map(M=>a.jsxs(Wa,{className:"overflow-hidden group border-border/50",children:[a.jsx("button",{className:"w-full aspect-[4/5] bg-muted/40 flex items-center justify-center overflow-hidden",onClick:()=>u(M.id),children:M.thumbnail?a.jsx("img",{src:M.thumbnail,alt:M.name,className:"w-full h-full object-cover",loading:"lazy"}):a.jsx(qe,{className:"w-8 h-8 text-muted-foreground/40",strokeWidth:1.5})}),a.jsxs("div",{className:"p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:M.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[M.format.width," à ",M.format.height," px"]})]}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(M),"aria-label":"Favorit",children:a.jsx(Pa,{className:`w-3.5 h-3.5 ${M.is_favorite?"fill-primary text-primary":""}`,strokeWidth:1.5})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(k,{variant:"secondary",size:"sm",className:"flex-1 h-7 text-xs",onClick:()=>u(M.id),children:"Ãffnen"}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>m(M),"aria-label":"Duplizieren",children:a.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),a.jsx(k,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>h(M.id),"aria-label":"Löschen",children:a.jsx(nt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]})]},M.id))});return a.jsxs("div",{className:"p-4 md:p-6 space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Mediengestaltung"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Vereinsgrafiken, Social Posts und Printvorlagen â im Design deines Teams."})]}),a.jsxs(k,{onClick:()=>w(!0),children:[a.jsx(Fa,{className:"w-4 h-4 mr-2",strokeWidth:1.5}),"Neues Design"]})]}),a.jsxs(Et,{defaultValue:"projects",children:[a.jsxs(Tt,{children:[a.jsxs(ue,{value:"projects",children:["Projekte (",r.length,")"]}),a.jsx(ue,{value:"favorites",children:"Favoriten"}),a.jsxs(ue,{value:"templates",children:["Eigene Vorlagen (",s.length,")"]})]}),a.jsx(ge,{value:"projects",className:"mt-4",children:te(r)}),a.jsx(ge,{value:"favorites",className:"mt-4",children:te(i.filter(v=>v.is_favorite))}),a.jsx(ge,{value:"templates",className:"mt-4",children:te(s)})]}),a.jsx(Ye,{open:b,onOpenChange:w,children:a.jsxs(Xe,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[a.jsx(Qe,{children:a.jsx(Je,{children:"Neues Design"})}),E&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(ze,{className:"w-4 h-4 animate-spin"})," Design wird erstellt â¦"]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ia,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",strokeWidth:1.5}),a.jsx(ce,{value:g,onChange:v=>C(v.target.value),placeholder:"Vorlage suchen (z. B. Matchday, Ergebnis, Geburtstag) â¦",className:"pl-9"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground flex items-center gap-1.5",children:[a.jsx(It,{className:"w-3.5 h-3.5",strokeWidth:1.5})," Vorlagen"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[K.map(v=>a.jsxs("button",{disabled:E,onClick:()=>N(v),className:"text-left p-3 rounded-xl border border-border/50 hover:border-primary/50 hover:bg-muted/40 transition-colors disabled:opacity-50",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:v.name}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[a.jsx(Da,{variant:"secondary",className:"text-[10px]",children:v.group}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:v.style})]})]},v.id)),K.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground col-span-full py-4",children:"Keine Vorlage gefunden."})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Leeres Format"}),ls.map(v=>a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs text-muted-foreground
84/80",children:v.label}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.formats.map(M=>a.jsx(k,{variant:"outline",size:"sm",disabled:E,onClick:()=>Z(M),children:M.name},M.id))})]},v.label))]})]})})]})}export{js 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.