1import{r as d,j as o,k as t,l as m,n as g,G as p,m as n,B as x,g as r,h as C}from"./index-qbwSSzHC.js";import{A as N,l as u}from"./AdminLayout-BOf1U8tc.js";import"./index-BPMNJrzz.js";import"./users-CkGBsrnp.js";import"./file-text-Dr5UXAuB.js";import"./circle-BapBo3O2.js";import"./circle-check-CitXkSz3.js";import"./mail-dEG3_Pc0.js";import"./trending-up-DKsWu--3.js";import"./building-2-B9VXW2nx.js";import"./shield-BJJhQ9We.js";import"./chevron-right-E4ulpjwd.js";import"./popover-JzxPM3bN.js";import"./index-IZjEkk41.js";import"./arrow-left-DvifoaTV.js";import"./arrow-right-Cg-SBf0Q.js";import"./house-pazqF5aZ.js";const H=()=>{const[c,i]=d.useState(!1),[s,h]=d.useState(null),j=async()=>{try{i(!0),r.info("Removendo fundo do logo...");const b=await(await fetch(u)).blob(),a=new FileReader,L=await new Promise(w=>{a.onloadend=()=>w(a.result),a.readAsDataURL(b)});console.log("Logo carregado, processando com IA...");const{data:v,error:l}=await C.functions.invoke("remove-logo-background",{body:{imageUrl:L}});if(l)throw l;console.log("Fundo removido com sucesso!"),h(v.imageUrl),r.success("Logo processado! Use o botão para baixar.")}catch(e){console.error("Erro ao processar logo:",e),r.error("Erro ao processar logo: "+e.message)}finally{i(!1)}},f=()=>{if(!s)return;const e=document.createElement("a");e.href=s,e.download="logo-transparent.png",document.body.appendChild(e),e.click(),document.body.removeChild(e),r.success("Logo baixado!")};return o.jsx(N,{children:o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight text-foreground",children:"Processar Logo"}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"Remova o fundo do logo automaticamente com IA"})]}),o.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[o.jsxs(t,{children:[o.jsxs(m,{children:[o.jsx(g,{children:"Logo Original"}),o.jsx(p,{children:"Com fundo marrom"})]}),o.jsx(n,{className:"flex justify-center",children:o.jsx("img",{src:u,alt:"Logo Original",className:"max-w-full h-auto max-h-64 object-contain"})})]}),o.jsxs(t,{children:[o.jsxs(m,{children:[o.jsx(g,{children:"Logo Processado"}),o.jsx(p,{children:"Fundo transparente"})]}),o.jsx(n,{className:"flex flex-col items-center gap-4",children:s?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-sidebar p-4 rounded-lg",children:o.jsx("img",{src:s,alt:"Logo Processado",className:"max-w-full h-auto max-h-64 object-contain"})}),o.jsx(x,{onClick:f,children:"Baixar Logo Transparente"})]}):o.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Clique em processar para gerar"})})]})]}),o.jsx(t,{children:o.jsx(n,{className:"pt-6",children:o.jsx(x,{onClick:j,disabled:c,size:"lg",className:"w-full",children:c?"Processando com IA...":"ðª Remover Fundo do Logo"})})})]})})};export{H 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.