PageSourceSearch

https://cesla.com.br/assets/conteudos-Dbax_b_V.js

js cesla.com.br collected 2026-10-09 21:56:26 UTC 6,143 bytes, 1 lines download raw bytes

1import{c as D,r as o,s as E,j as e,t as c}from"./main-PqYkaywL.js";import{c as F,u as L}from"./createServerFn-CAJHJqIO.js";import{S as T}from"./SiteLayout-BnwX3Vkv.js";import{D as B,a as I,b as q,c as P,d as M,e as O}from"./dialog-DonD4QiV.js";import{I as p}from"./input-B5g4HLct.js";import{L as u}from"./label-CEBeCynm.js";import{B as j}from"./button-Cx_HQK9f.js";import{B as z}from"./book-open-CmPiXtcw.js";import{D as v}from"./download-CHl-bV8c.js";import{L as H}from"./youtube-D8GQc42h.js";import{o as R,s as x}from"./types-KBJzO2d1.js";import"./Footer-BM1bsbiy.js";import"./cesla-logo-BFl5Yo9z.js";import"./chevron-down-NOB6KRfE.js";import"./createLucideIcon-Dxaekzza.js";import"./x-CnGuBL56.js";import"./index-D4J0u-JF.js";import"./index-BJnkw_Nb.js";import"./Combination-cTK5PEun.js";import"./index-BQqN8Y3f.js";import"./utils-BQHNewu7.js";const $=F({method:"POST"}).handler(D("c25ab75557b0568a9cdbb8d13f6d37fb8046837ba67a27cc47713e6da0a4835d")),A=R({name:x().trim().min(1,"Informe seu nome").max(120),company:x().trim().min(1,"Informe a empresa").max(200),phone:x().trim().min(1,"Informe um telefone").max(40),email:x().trim().min(1,"Informe seu e-mail").email("E-mail inválido").max(255)}),y={name:"",company:"",phone:"",email:""};function ce(){const[g,N]=o.useState([]),[C,w]=o.useState(!0),[s,h]=o.useState(null),[t,f]=o.useState(y),[n,i]=o.useState(!1),k=L($);o.useEffect(()=>{E.from("ebooks").select("id,title,cover_image_url,pdf_url").eq("is_published",!0).order("display_order",{ascending:!0}).then(({data:a})=>{N(a??[]),w(!1)})},[]);const S=a=>{h(a),f(y)},b=()=>{n||h(null)},d=a=>l=>f(m=>({...m,[a]:l.target.value})),_=async a=>{if(a.preventDefault(),!s)return;const l=A.safeParse(t);if(!l.success){c.error(l.error.issues[0]?.message??"Dados inválidos");return}i(!0);try{if(!(await k({data:{...l.data,ebook_id:s.id,ebook_title:s.title}}))?.ok){c.error("Não foi possível processar. Tente novamente."),i(!1);return}c.success("Tudo certo! Seu download vai começar.");const r=document.createElement("a");r.href=s.pdf_url,r.download=s.title?`${s.title}.pdf`:"ebook.pdf",r.target="_blank",r.rel="noopener noreferrer",document.body.appendChild(r),r.click(),document.body.removeChild(r),i(!1),h(null)}catch(m){console.error(m),c.error("Erro ao enviar. Tente novamente."),i(!1)}};return e.jsxs(T,{children:[e.jsx("header",{className:"border-b border-border bg-gradient-cesla py-20 text-primary-foreground",children:e.jsxs("div",{className:"mx-auto max-w-7xl px-6 lg:px-8",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.3em] opacity-80",children:"Cesla"}),e.jsx("h1",{className:"mt-2 text-4xl font-bold md:text-5xl",children:"Conteúdos"}),e.jsx("p",{className:"mt-3 max-w-2xl text-base opacity-90",children:"E-books gratuitos para aprofundar conhecimentos em EHS, segurança e transformação digital."})]})}),e.jsx("section",{className:"mx-auto max-w-7xl px-6 py-12 lg:px-8",children:C?e.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[0,1,2].map(a=>e.jsx("div",{className:"h-[420px] animate-pulse rounded-2xl bg-muted"},a))}):g.length===0?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-12 text-center text-muted-foreground",children:"Nenhum e-book publicado ainda."}):e.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:g.map(a=>e.jsxs("article",{className:"group flex flex-col overflow-hidden rounded-2xl border border-border bg-card transition-all hover:-translate-y-1 hover:shadow-elegant",children:[e.jsx("div",{className:"relative aspect-[3/4] overflow-hidden bg-muted",children:a.cover_image_url?e.jsx("img",{src:a.cover_image_url,alt:a.title,className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",loading:"lazy"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-cesla",children:e.jsx(z,{className:"h-20 w-20 text-white/60"})})}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-5",children:[e.jsx("h3",{className:"text-lg font-bold leading-snug text-foreground group-hover:text-cesla-blue",children:a.title}),e.jsxs("button",{type:"button",onClick:()=>S(a),className:"mt-auto inline-flex items-center justify-center gap-2 rounded-full bg-cesla-blue px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-cesla-blue/90",children:[e.jsx(v,{className:"h-4 w-4"})," Baixar e-book"]})]})]},a.id))})}),e.jsx(B,{open:!!s,onOpenChange:a=>a?null:b(),children:e.jsxs(I,{className:"sm:max-w-[480px]",children:[e.jsxs(q,{children:[e.jsx(P,{children:"Baixar e-book"}
1),e.jsx(M,{children:s?`Preencha os dados para receber "${s.title}".`:"Preencha os dados para receber o e-book."})]}),e.jsxs("form",{onSubmit:_,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"lead-company",children:"Empresa *"}),e.jsx(p,{id:"lead-company",value:t.company,onChange:d("company"),autoComplete:"organization",required:!0,maxLength:200})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"lead-name",children:"Nome *"}),e.jsx(p,{id:"lead-name",value:t.name,onChange:d("name"),autoComplete:"name",required:!0,maxLength:120})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"lead-phone",children:"Telefone *"}),e.jsx(p,{id:"lead-phone",type:"tel",inputMode:"tel",value:t.phone,onChange:d("phone"),autoComplete:"tel",required:!0,maxLength:40})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"lead-email",children:"E-mail *"}),e.jsx(p,{id:"lead-email",type:"email",value:t.email,onChange:d("email"),autoComplete:"email",required:!0,maxLength:255})]})]}),e.jsxs(O,{className:"gap-2 sm:gap-2",children:[e.jsx(j,{type:"button",variant:"ghost",onClick:b,disabled:n,children:"Cancelar"}),e.jsx(j,{type:"submit",disabled:n,className:"bg-cesla-blue text-white hover:bg-cesla-blue/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"h-4 w-4 animate-spin"})," Enviando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"h-4 w-4"})," Baixar agora"]})})]})]})]})})]})}export{ce as component};

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.