/* Hoard Haulers website forms — v1 (13 Sep 2026). Shared by the Contact page, the Commercial walk-through request and the hoarding estimate form. Uploads photos/videos straight to the private Supabase bucket 'lead-uploads' (anon insert only, nobody can read them back without an Office login), then posts the form to the web-lead edge function, which files the customer, note, lead, files, bell alert and the getquote@ email. Patch via asset-put. */ (function(){ var SB = 'https://jwqnuofcawgqrvsjujxr.supabase.co'; var ANON = 'sb_publishable_L1RqXdd1oWEvno3sqckxsQ_CIzGcuL_'; var LEAD = SB + '/functions/v1/web-lead?k=hhlead-2026-R7tQ2mV9xL4pN8sK'; var MAX_FILES = 12, MAX_MB = 200; function rnd(){ return Math.random().toString(36).slice(2, 10); } function safeName(n){ return String(n || 'file').replace(/[^A-Za-z0-9._-]+/g, '-').slice(-80); } window.hhUploadFiles = async function(fileList, onProgress){ var files = [].slice.call(fileList || []).slice(0, MAX_FILES), out = [], i; var day = new Date().toISOString().slice(0, 10); for (i = 0; i < files.length; i++){ var f = files[i]; if (f.size > MAX_MB * 1048576) throw new Error(f.name + ' is over ' + MAX_MB + ' MB — please trim the video or send it by text to (843) 861-8000.'); if (!/^(image|video)\//.test(f.type)) throw new Error(f.name + ' is not a photo or video.'); var path = 'web/' + day + '/' + rnd() + '-' + safeName(f.name); if (onProgress) onProgress(i + 1, files.length, f.name); var r = await fetch(SB + '/storage/v1/object/lead-uploads/' + path, { method: 'POST', headers: { apikey: ANON, Authorization: 'Bearer ' + ANON, 'Content-Type': f.type || 'application/octet-stream', 'x-upsert': 'false' }, body: f }); if (!r.ok){ var t = ''; try { t = (await r.json()).message || ''; } catch(e){} throw new Error('Upload failed for ' + f.name + (t ? ' (' + t + ')' : '')); } out.push({ path: path, name: f.name, type: f.type, size: f.size }); } return out; }; window.hhLeadSend = async function(payload){ payload.page_url = location.href; var r = await fetch(LEAD, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); var j = {}; try { j = await r.json(); } catch(e){} if (!r.ok || !j.ok) throw new Error((j && j.error) || 'send failed'); return j; }; /* Wires any