/* eslint-disable */ // Shared gated-PDF download modal. // Exposes window.openGatedPdf(src, title) which mounts a form modal, // and on submit triggers the actual file download. (function () { const { useState, useEffect } = React; function GatedPdfModal({ src, title, onClose }) { const [form, setForm] = useState({ fn: '', ln: '', email: '', org: '', role: 'Facilities / Operations', consent: true, newsletter: true }); const upd = (k, v) => setForm((f) => ({ ...f, [k]: v })); const valid = form.fn && form.ln && form.email.includes('@') && form.org && form.consent; useEffect(() => { const onKey = (e) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', onKey); const prevOverflow = document.body.style.overflow; document.body.style.overflow = 'hidden'; return () => { window.removeEventListener('keydown', onKey); document.body.style.overflow = prevOverflow; }; }, [onClose]); const submit = () => { if (!valid) return; // Trigger download const a = document.createElement('a'); a.href = src; a.download = (src.split('/').pop() || 'document.pdf'); a.target = '_blank'; a.rel = 'noopener'; document.body.appendChild(a); a.click(); document.body.removeChild(a); onClose({ submitted: true, name: form.fn }); }; const lbl = { fontSize: 12, fontWeight: 700, color: '#1F1F1F', display: 'block', marginBottom: 4 }; const inp = { width: '100%', padding: '11px 13px', border: '1px solid #D4D4D4', borderRadius: 6, fontSize: 14, fontFamily: 'inherit', background: '#fff', outline: 'none', boxSizing: 'border-box' }; return (
onClose()} style={{ position: 'fixed', inset: 0, background: 'rgba(15,15,15,.62)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 1000, padding: 24 }}>
e.stopPropagation()} style={{ background: '#fff', borderRadius: 14, maxWidth: 560, width: '100%', overflow: 'hidden', boxShadow: '0 24px 64px rgba(0,0,0,.32)', position: 'relative', maxHeight: '90vh', display: 'flex', flexDirection: 'column' }}>
Free download · PDF

{title || 'Download the case study'}

Tell us a bit about you and we'll send the PDF straight to your browser.

upd('fn', e.target.value)} />
upd('ln', e.target.value)} />
upd('email', e.target.value)} />
upd('org', e.target.value)} placeholder="Agency, district, institution, or operator" />
); } // Mount point + global trigger let mountEl = null; let root = null; function ensureMount() { if (mountEl) return; mountEl = document.createElement('div'); mountEl.id = '__gated_pdf_mount'; document.body.appendChild(mountEl); root = ReactDOM.createRoot ? ReactDOM.createRoot(mountEl) : null; } function close() { ensureMount(); if (root) root.render(null); else ReactDOM.unmountComponentAtNode(mountEl); } window.openGatedPdf = function (src, title) { if (!src) return; ensureMount(); const el = React.createElement(GatedPdfModal, { src: src, title: title, onClose: close }); if (root) root.render(el); else ReactDOM.render(el, mountEl); }; })();